Yuck! I can't stand ?.() and ?.[]. Although I understand that the operator is ?., they should've made the ?() and ?[] sugars work, too!
?.()
?.[]
?.
?()
?[]
const a = b ? c?[0] : d?(1) : "small potatoes"
What do you see?
b
c[0]
d
1
"small potatoes"
c
[0]
d(1)
Me too.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yuck! I can't stand
?.()
and?.[]
. Although I understand that the operator is?.
, they should've made the?()
and?[]
sugars work, too!What do you see?
b
then safe access toc[0]
, else ifd
then1
else"small potatoes"
orb
then ifc
an array[0]
else safe call tod(1)
, else"small potatoes"
?Me too.