Inside and Outside the Block
JavaScript
20 pts
Inside and Outside the Block
The starter code crashes with a SyntaxError. Fix it and finish the program:
- Line 2 must change the existing
cityto"Keren"(no second declaration). - Add a block
{ }between the two prints. Inside it, declare a newlet city = "Massawa";and printTrip: Massawa. - After the block, the outer
citymust still be"Keren".
Home: Keren Trip: Massawa Still home: Keren
Checklist
- Fix the second line so it reassigns
city. - Add a block with its own
city. - Keep the outer
cityunchanged. - Print the three lines.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
