Optional Chaining Cannot Be Used on the Left-Hand Side


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.