Skip to content

Instantly share code, notes, and snippets.

Created December 6, 2015 19:37
Show Gist options
  • Save anonymous/94b0e649d2cabb1c678b to your computer and use it in GitHub Desktop.
Save anonymous/94b0e649d2cabb1c678b to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/fcc0208647c 's solution for Bonfire: Mutations
// Bonfire: Mutations
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function mutation(arr) {
firstElement = arr[0].toLowerCase().split('');
secondElement = arr[1].toLowerCase().split('');
for (var i=0; i<secondElement.length; i++) {
if(firstElement.indexOf(secondElement[i]) === -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