Written by Gbolahan Olagunju✏️
JavaScript has come a long way since its early days, with many new additions and features designed specifically to ...
For further actions, you may consider blocking this person and/or reporting abuse
Optional chaining is something I'm so delighted to see.
All of us have written obj.property && obj.property.anotherProperty, and it's a pain to the eyes when the properties are long.
I hate to be that guy, but I need to nitpick some details of this article. My intention is just to help!
This section...
should be this
Am I right?
And regarding the Optional catch binding, is the structure of both codes really similar?
Take a look at the below code, the
console.log()
line will only be executed if thetry
block failNow, take a look at the below code, which have the optional catch binding ... the
console.log()
will be executed whether thetry
block fails or not. Not only when it fail, like the previous version.I am thinking here... maybe the similar structure will be something like this...
Am I right?
Thanks!
Great article, I personally love the optional chaining operator
?.
, this makes the code so much more readable. However, it is good to mention that we need to avoid calling it when it it is not necessary, otherwise we can have unnecessary performance issues and unclear code behaviors. 👍pipeline operator !! yay
Wow, I am working on a project right now that could literally use all of these features on an extensive level. I’ve found ts-optichain for optional chaining very good for now but the rest, I would really love to see. Is there a way to use these features with babel maybe?
Buen post!
Gracias por el aporte.
Is this real life? or is just fanta-sea?
By the way, I don't see why would we need to add an empty catch block, it will be better to make it entirely optional.
U should open a proposal or something, amazing idea
Hey, small detail:
In the code for trimStart/trimEnd you misspell 'massage'. Also, the output of
message.trimEnd();
would still have the spaces at the start (left) of the string right?Nice article. Just a little bug. A quote is missing in the function sayName() console.log
Indeed missing backtick at the start of the log
Nested chaining 👌
Hasn’t ECMAScript 2019 already been released?
WOOT FOR OPTIONAL CHAINING!
Can't wait to see Optional Chaining