Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Ending Statements With Semicolons

Ending Statements With Semicolons

The release note swaps Maya and Theo. Python’s one-line swap becomes a given JavaScript destructuring swap, with square brackets on both sides; fuller destructuring comes later. Both names use let because the swap reassigns them.

  • A semicolon ends a JavaScript statement. A newline isn’t always the end.
  • Here the next let can’t continue the declaration after "Maya", so JavaScript inserts a semicolon automatically. That’s automatic semicolon insertion.
  • After "Theo", the opening [ can continue the initializer. The two lines join, reading nextDeployer while that name is still being declared. It has no value yet, so the port stops.
  • Semicolon-free JavaScript is a real style. This course writes semicolons, keeping this swap separate. A formatter, a layout tool like Black in Python, then keeps them in place.

The semicolon-free port prints nothing and stops with an error. Only the error line is shown:

Language: Program Output
ReferenceError: Cannot access 'nextDeployer' before initialization

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.