Tell us what’s happening:
Hi campers,
I have been working on this challenge on Repl.it and it does pass all tests both there and on my console. However, I am not passing the fearNotLetter(“abcdefghijklmnopqrstuvwxyz”) should return undefined test on FCC.
Could you take a look and let me know why my code is having problems?
Thanks!
Your code so far
let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
function fearNotLetter(str) {
let foundLetter = "";
let target = str.split('');
let alphabetPortion = alphabet.slice(alphabet.indexOf(target[0]));
for (let i = 0; i <= target.length; i++) {
if (target.indexOf(alphabetPortion[i]) === -1) {
foundLetter += alphabetPortion[i];
}
}
if (foundLetter.length > 0) {
return foundLetter;
}
else {
return undefined;
}
}
fearNotLetter("abce");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters