For loop undefined

for (var i = arr.length - 1; i >= 0; i–) {

Can anyone explain why this keeps returning undefined when i try to print the entire array?

Where indicated should be a double dash, as in, i--.

1 Like

Alright, I’m not sure why the original post doesn’t have the double dash, because my original code does. Any other ideas as to why?

No idea. Remember that the LE is an environment and as such can have one or more flaws in the overall logic, including typos. It is imperative that we double check our own work at every step. If you find a bug that can be reproduced, report it to CC.

Okay, thank you! I’ll go over my code again to be sure that it isn’t some missed space or something on my end

1 Like