DEV Community

Discussion on: Optional Chaining may be coming to JavaScript

Collapse
 
nikolay profile image
Nikolay Kolev • Edited

Yuck! I can't stand ?.() and ?.[]. Although I understand that the operator is ?., they should've made the ?() and ?[] sugars work, too!

Collapse
 
qm3ster profile image
Mihail Malo • Edited
const a = b ? c?[0] : d?(1) : "small potatoes"

What do you see?

  • If b then safe access to c[0], else if d then 1 else "small potatoes" or
  • If b then if c an array [0] else safe call to d(1), else "small potatoes"?

Me too.