jeudi 25 juin 2020

Object destructuring in JavaScript [duplicate]

>{a} = {a: true} // Statement
<{a: true}

The above statement is assigning the value true to a

Why is the above statement not giving error in the chrome console? While the below statement gives an error.

>{a} = {a: true}; // Statement
<Uncaught SyntaxError: Unexpected token '='

How does the semicolon at the end matter?




Aucun commentaire:

Enregistrer un commentaire