Skip to content

Instantly share code, notes, and snippets.

Created December 6, 2015 07:57
Show Gist options
  • Save anonymous/90687aa27249e9b4ada9 to your computer and use it in GitHub Desktop.
Save anonymous/90687aa27249e9b4ada9 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/bskydive 's solution for Bonfire: Mutations
// Bonfire: Mutations
// Author: @bskydive
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function mutation(arr) {
var result=true;
var i=0;
var arr1ToLower = arr[0].toLowerCase();
var arr2ToLower = arr[1].toLowerCase().split('');
while (i<arr2ToLower.length){
if (arr1ToLower.indexOf(arr2ToLower[i])<0) {result=false;i=arr2ToLower.length;}
i++;
}
return result;
}
mutation(["hello", "hey"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment