Created
February 7, 2022 20:59
-
-
Save Tomut0/4bd5882d8f8258f2e7d3cc6f7153a3e7 to your computer and use it in GitHub Desktop.
Does elements from one array contains in another one?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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