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. 👍
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.
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. 👍