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
letcan’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, readingnextDeployerwhile 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:
ReferenceError: Cannot access 'nextDeployer' before initialization