Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 11: Managing Errors, Debugging, and Handling Events in JavaScript!

Instruction

SyntaxError: a declaration in the head of a for-of loop can't have an initializer

The JavaScript exception "a declaration in the head of a for-of loop can't have an initializer" occurs when the head of a for...of loop contains an initializer expression such as for (const i = 0 of iterable). This is not allowed in for-of loops.

Message:

  • SyntaxError: for-of loop variable declaration may not have an initializer. (V8-based)
  • SyntaxError: a declaration in the head of...