JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Create a for Loop

Devis Mejia
Devis Mejia
1,956 Points

Not sure why I'm getting an error on my for loop. Works in my console.

Task says: Create a for loop that logs the numbers 4 to 156 to the console. To log a value to the console use the console.log( ) method.

My code: for (let i=4; i<=156; i++) { console.log(i); }

The error: Bummer: There was an error with your code: SyntaxError: Parse error

I ran it in my console and it logs all numbers between 4 and 156.

2 Answers

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,163 Points

Some of the challenges predate the use of let. Try with var instead.