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

Greg Gancarz
Greg Gancarz
2,868 Points

wtf wheres the stupid parse error

is this a joke? This code would run just fine

script.js
for (let i = 4; i < 157; i++) {
  const printed = i;
  console.log(printed);
};

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 46,096 Points

The checker doesn't support let. Remove that and you'll pass.

Liam Clarke
MOD
Liam Clarke
Treehouse Moderator 19,186 Points

Yes the compiler seems to not work with es6

your code is correct, just change it to var like below:

for ( var i = 4; i <= 156; i++ ) {
  console.log(i);
}