Мутации
// Mutations
// 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.
function mutation(arr) {
let second = arr[1].toLowerCase();
let first = arr[0].toLowerCase();
for (let i = 0; i < second.length; i++) {
if (first.indexOf(second[i]) < 0) return false;
}
return true;
}
mutation(['floor', 'FLOOR']);
// OR
function mutation(arr) {
return arr[1]
.toLowerCase()
.split('')
.every(function (letter) {
return arr[0].toLowerCase().indexOf(letter) != -1;
});
}
YosKa