Skip to content

Instantly share code, notes, and snippets.

@Tomut0
Created February 7, 2022 20:59
Show Gist options
  • Save Tomut0/4bd5882d8f8258f2e7d3cc6f7153a3e7 to your computer and use it in GitHub Desktop.
Save Tomut0/4bd5882d8f8258f2e7d3cc6f7153a3e7 to your computer and use it in GitHub Desktop.
Does elements from one array contains in another one?
/**
* Does elements from one array contains in another one?
*
* @param {Array} target Array which must contain elements of arr
* @param {Array} arr Array with elements
* @returns {boolean}
*/
export function containsArr(target, arr) {
return arr.every(item => target.includes(item));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment