Help with Missing Letters Challenge

Continuing the discussion from freeCodeCamp Challenge Guide: Missing letters:

In solution 1:

Why is the code wrong if we put (0 + i) instead?

(charCode !== str.charCodeAt(0+i))

Should it not work in both cases?

Use console.log to compare the results of the two expressions.

I did but I did not understand why.

One is the character code for the character at index i, the other is the character code for the first character + the index.

Work out the difference between those two calculations for a small example, like abce

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.