Skip to content

Instantly share code, notes, and snippets.

@robertsheacole
Forked from anonymous/bonfire-mutations#.js
Created December 7, 2015 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertsheacole/fa780b6d0bd35d4a9728 to your computer and use it in GitHub Desktop.
Save robertsheacole/fa780b6d0bd35d4a9728 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/robertsheacole 's solution for Bonfire: Mutations
// Bonfire: Mutations
// Author: @robertsheacole
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function mutation(arr) {
var first = arr[0].toLowerCase().split('');
var query = arr[1].toLowerCase().split('');
for (var i = 0; i < query.length; i++){
var value = first.indexOf(query[i]);
if (value === -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