Created
September 27, 2016 16:49
-
-
Save mitrakmt/6dcde9b0c4b4b9a16ccd7f1b94ce8d65 to your computer and use it in GitHub Desktop.
Exploring the is subset of programming interview question.
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
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