Check if the first string contains all the letters of the second string

Check if the first string contains all the letters of the second string:

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.
The problem that I am facing is that the code produces false for ["Mary", "Aarmy"] which it should not do!

function mutation(arr) {

for(let i in arr){

let i=0, j=0, cnt=0;
if(cnt==arr[1].length) return true;
return false;

mutation(["Mary", "Aarmy"]);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57.

Challenge: Mutations

Link to the challenge:

Hi put your return true in curly brackets and after write else in return false in curly bracket. Your just not constructing your conditional with else and curly brackets, just look if else statement on Google the right syntax. Hope that helps.

Not at my computer so can’t type it out easily for you on my phone.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.