I can’t get why this code is wrong. I must be something obvious, I still can’t see it. Please give me hints so that I can solve this challenge
function fearNotLetter(str) {
for (var i = 1; i < str.length; i++) {
if (str.charCodeAt(i) == str.charCodeAt(i-1)+1) {
continue;
} else {
return str.fromCharCode(str.charCodeAt(i));
}
}
return undefined;
}
Mizu
2
In your else statement, you should call fromCharCode
differently :
String.fromCharCode(str.charCodeAt(i));
See the following information page : http://devdocs.io/javascript/global_objects/string/fromcharcode
1 Like
Thanks @Mizu. I corrected it into this:
return String.fromCharCode(str.charCodeAt(i));
However, I am still getting two red ticks. What else could be wrong?
Mizu
4
Have you noticed that your return statement actually doesn’t return the missing letter ? What needs to be done ?
Thanks again! I totally forgot it. I should add minus 1.
It works now
1 Like
Mizu
6
Happy to help Good coding!
1 Like
Thanks, to you too! All the best!