Tell us what’s happening:
My code worked and passed, so I don’t have a problem with that but I was wondering if it would be possible to solve this using regular expressions. eg something like
toMatch = /[^a-z]/
Just curious?
Your code so far
function fearNotLetter(str) {
for (var i=0; i<str.length; i++){
var code=str.charCodeAt(i);
if(code!==str.charCodeAt(0) + i){
return String.fromCharCode(code-1);
}
}
return undefined;
}
fearNotLetter("abce");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36.
I think we might need more of an explanation than just toMatch = /[^a-z]/ in order to answer your question. Would you give us more details about how you were thinking this could be solved?
Upon further discussion with my husband though of why you couldn’t use tomatch all the letters matching from a-z as if you weren’t given all the code from a-z it would likely return all the missing letters. Will investigate further as only new to this and if I can solve it in a different way might reply again.