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

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

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,333 Points

Try it with var instead of let

Thank you

Steven Parker
Steven Parker
200,760 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.