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

Robert Rydlewski
Robert Rydlewski
3,043 Points

I get a syntax error. Do You know why >?

Hi, I can't find syntax error.

script.js
for ( i = 4; i <= 156; i ++1; ) {
  console.log (i);
}

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 49,924 Points

There shouldn't be a semicolon or a one after i++.

Maxwell Newberry
Maxwell Newberry
Front End Web Development Techdegree Student 7,674 Points

Remove the last ; and add var to initialize i as a variable if you hadn't done so before in your for-loop's condition.

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