this is my challenge: Create a function that will find the missing letter passed in the parameter and return it. If all letters are present in the string, the return will be undefined. For example missingLetter("abce") should return "d", missingLetter("bcd") should return undefined.
I am having trouble with this one, can you please tell me if I am on the right track with my code:
var missingLetter = function(char){
var missing = "";
var str = "abcdefghijklmnopqrstuvwxyz";
for (var i = char[0]; i < char.length; i++){
for(var y = char[0].indexOf(str); y < char.length; y++ ){
if(char[y].indexOf(str) == -1 ){
missing.push(char[y]);
}
}
}
console.log(missing);
return missing;
}
missingLetter("abce")