Skip to content

Instantly share code, notes, and snippets.

@WonderDev21
Created January 6, 2018 01:03
Show Gist options
  • Save WonderDev21/4ac851f45d946911d509a451c004e553 to your computer and use it in GitHub Desktop.
Save WonderDev21/4ac851f45d946911d509a451c004e553 to your computer and use it in GitHub Desktop.
Yuki's Answer1
function isSubset (array1, array2) {
var temp = [];
array1 = array1.toString().split(',').map(Number);
array2 = array2.toString().split(',').map(Number);
for(i in array2) {
if(array1.indexOf(array2[i]) === -1) temp.push(array2[i]);
}
if(temp.length>0) return false;
else return true;
}
console.log(isSubset([1,2,3,4,5], [2,3,1]));///true
console.log(isSubset([1,2,3,4,5], [2,3,9]));///false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment