Created
December 3, 2015 22:01
-
-
Save anonymous/a562c78a19c7f0215d29 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mattnwa 's solution for Bonfire: Mutations
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
// Bonfire: Mutations | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function mutation(arr) { | |
var elem0 = arr[0].toLowerCase(); | |
var elem1 = arr[1].toLowerCase(); | |
for(var i = 0; i < elem1.length; i++){ | |
var check = elem0.indexOf(elem1[i]); | |
if (check === -1){ | |
return false; | |
} | |
} | |
return true; | |
} | |
mutation(["hello", "hey"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment