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...
String.trimStart and String.trimEn
should be this
String.trimStart and String.trimEnd
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 the try block fail
try{constparsedJsonData=JSON.parse(obj);}catch(error){//the variable error has to be declared weather used or unusedconsole.log(obj);}
Now, take a look at the below code, which have the optional catch binding ... the console.log() will be executed whether the try block fails or not. Not only when it fail, like the previous version.
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. 👍
Hi there, I am a Full Stack Developer Based in Nagpur, India. I've been coding for the past 4 years working on multiple technologies and stages of product development such as MVPs, DevOps, etc.
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?
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.
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?
I'm a guy who love code, want to solve many problems writing code 💻 and learning on the way.Of course write code listening music, without that is almost impossible 🎧
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 thetryblock failNow, take a look at the below code, which have the optional catch binding ... the
console.log()will be executed whether thetryblock 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. 👍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?
pipeline operator !! yay
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?Buen post!
Gracias por el aporte.
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
Can't wait to see Optional Chaining
Hasn’t ECMAScript 2019 already been released?
Nested chaining 👌