-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMutations
More file actions
17 lines (13 loc) · 711 Bytes
/
Mutations
File metadata and controls
17 lines (13 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
//For example, ["hello", "Hello"], should return true because all of the letters in the second string are present in the first, ignoring case.
//The arguments ["hello", "hey"] should return false because the string "hello" does not contain a "y".
//Lastly, ["Alien", "line"], should return true because all of the letters in "line" are present in "Alien".
function mutation(arr) {
var test = arr[1].toLowerCase();
var target = arr[0].toLowerCase();
for (i=0;i<test.length;i++) {
if (target.indexOf(test[i]) === -1)
return false;
}
return true;
}