Why is semicolon changing JavaScript behavior in the Chrome console

Viewed 141

This code executes perfectly in the google chrome console:

{ a, b } = { a: 10, b: 20 }

{a: 10, b: 20}

But when I add semicolon at the end, I get syntax error:

{ a, b } = { a: 10, b: 20 };

VM115:1 Uncaught SyntaxError: Unexpected token '='

Can someone tell me why? AFAIK ; should not affect the meaning in javascript but apparently it does in google chrome console.

P.S. Please pay attention that this behavior is only observed in Google Chrome console.

1 Answers
Related