DEV Community

Discussion on: I do this all the time to reduce bugs in my javascript code #1

Collapse
 
evanplaice profile image
Evan Plaice • Edited

FYI. There is an 'Optional Chaining' TC39 proposal that suggests adding this capability as a standard, built-in feature of JS.

Ex

data.course?.enrolments?
  .forEach(enrolment => enrolment.confirm?())
Collapse
 
bahdcoder profile image
Kati Frantz

Wow this is interesting. Thanks for sharing this Evan !

Collapse
 
evanplaice profile image
Evan Plaice

Sure thing. The proposal is at Stage 2 which is promising. It means there are devs actively working out the kinks in the spec. If it lands it'll probably be available in a few years.

If you're interested in how new JS features become standards, check out github.com/tc39.

If you have feedback. Jump into the issues for a proposal. There's no gatekeep to participation.

BTW, nice tip 👍. I'll have to put this to use.