function mutation(arr) { arr = [arr[0].toLowerCase(),arr[1].toLowerCase()]; var flag = []; var count = 0; for (var i = 0;i< arr[1].length; i++) { flag[i] = arr[0].indexOf(arr[1][i]); } for(i=0;i<flag.length;i++){ if(flag[i]<0){ count++; } } if(count===0){ return true; }else{ return false; } } console.log(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstuz"]));