Bada
Bada's Coding

Bada's Coding

Optional Chaining Cannot Be Used on the Left-Hand Side

Bada's photo
Bada
·Nov 15, 2022·

1 min read

let a = {};

a?.k1 = 1;

If you run the above example, you will meet this error in Chrome.

Invalid left-hand side in assignment

I think it should not be accepted because things should not be assigned to other than identifiers.

 
Share this