String Challenge

I have been trying to solve the string challenge which returns the string true if every single letter of the English alphabet exists in the string, otherwise return the string false my output is showing correct result but it’s also showing undefined with the output as well.
I am attaching my code for more reference :

function StringChallenge(str) { 
 let exist =[];
 for (let i=0; i <str.length; i++){
   exist[str[i]]=1;
 }
 for (let i=0 ; i<=25; i++){
  let  c = String.fromCharCode(i);
   if (!exist [c]){
     console.log( false);
     break;
   }
   return str;
 } 


};

console.log(StringChallenge("abcdefghijklmnopqrstuvwxyyyy"));

Current Output :
false
undefined

Desired Output :
false

@camperextraordinaire please help. It’s urgent.

On every challenge on the lower corner of the left you can see the tests been tried on your code. Try to see what inputs are passed to your function to understand which one is returning undefined and why.

Moreover, returning false or true is not the same as console.log(false). The first one is a value returned by the function when called, while the latter is just displaying false on console.

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