Last active
May 8, 2019 16:35
-
-
Save fernandojsg/13ca20be5650f58f424f49cb75b4dad4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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