Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2015 22:01
Show Gist options
  • Save anonymous/a562c78a19c7f0215d29 to your computer and use it in GitHub Desktop.
Save anonymous/a562c78a19c7f0215d29 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mattnwa 's solution for Bonfire: Mutations
// 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