Created
December 22, 2016 17:37
-
-
Save bflannery/dd1202ffd4724628df92756e0103c44e to your computer and use it in GitHub Desktop.
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
// Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array. | |
function mutation(arr) { | |
// console.log(arr[1].toLowerCase().split('')) | |
return arr[1].toLowerCase() | |
.split('') | |
.every((letter) => { | |
// console.log(arr[0].toLowerCase().indexOf(letter)); | |
return arr[0].toLowerCase() | |
.indexOf(letter) != -1; | |
}); | |
} | |
console.log(mutation(["hello", "hey"])); | |
console.log(mutation(["hello", "neo"])); | |
console.log(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment