My codepen with the algorithm is here and I feel like I’m stuck. I’m trying to set up a first and last character check, and then just push out whatever the full string should be, basically, so if they put ABDE it just shoves out the range from A-E no questions asked. Any help on this?
This line:
emptyStr.push(alphabet.fromCharCode(strChar[0],strChar[-1]));
is wrong. Check syntax here.
And here:
.charCodeAt()
an argument is missing.
if they put ABDE it just shoves out the range from A-E no questions asked
Can you explain me how will this find the missing letter (I’m not being snarky, I’m really curious)?
Try to think about it like this:
if the input is a range with one missing letter, why not go through the input string and for each character check if the next character’s code is current character’s code +1
?
I had totally misread the assignment and was trying to produce a string that included the whole range WITH the missing letter, not just finding the missing letter . It was my bad, but thanks for looking into it for me.