Skip to content

Instantly share code, notes, and snippets.

@mitrakmt
Created September 27, 2016 16:49
Show Gist options
  • Save mitrakmt/6dcde9b0c4b4b9a16ccd7f1b94ce8d65 to your computer and use it in GitHub Desktop.
Save mitrakmt/6dcde9b0c4b4b9a16ccd7f1b94ce8d65 to your computer and use it in GitHub Desktop.
Exploring the is subset of programming interview question.
Array.prototype.isSubsetOf = function(inputArray) {
var exists = true;
for (var i = 0; i < this.length; i++) {
if (inputArray.indexOf(this[i]) === -1) {
exists = false;
}
}
return exists;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment