Home > other >  What does the statement a:bc = 9 will do in javascript?
What does the statement a:bc = 9 will do in javascript?

Time:09-29

I have written a:bc = 9 in javascript.

when i `console.log(bc) its printing 9

but when I console.log(a) it gives "a" is not defined.

could anyone help me understand what is happening here?

CodePudding user response:

a:bc = 9

As per ECMAScript only a:bc = 9 its just a label and the last bc gets assigned to 9 and a will not have any effects.

console.log(bc); // 9 only this statement will work
  • Related