JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Refactor Using a Loop

Kim Dallas
Kim Dallas
11,461 Points

it won't work

nothing works.

script.js
for (let i = 2; i <= 24; i += 2) {
  console.log( i );
}
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

2 Answers

Steven Parker
Steven Parker
171,314 Points

Your solution is good, but this course's validator apparently doesn't recognize ES6 syntax. Change the "let" to "var" and you'll pass the challenge.