Skip to content

Instantly share code, notes, and snippets.

@fernandojsg
Last active May 8, 2019 16:35
Show Gist options
  • Save fernandojsg/13ca20be5650f58f424f49cb75b4dad4 to your computer and use it in GitHub Desktop.
Save fernandojsg/13ca20be5650f58f424f49cb75b4dad4 to your computer and use it in GitHub Desktop.
function existsInArray(array, items) {
var all = true;
for (i = 0; i < items.length; i++) {
all &= array.indexOf(items[i]) !== -1;
}
return all;
}
if (!existsInArray(['a', 'c'], ['c'])) {
console.log('No');
} else {
console.log('Yes');
}
if (existsInArray(['a', 'c'], ['a', 'c']) === true) {
console.log('Yes!');
} else {
console.log('No!');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment