A skilled software engineer, talented problem-solver and team player with a passion for using technology to solve complex problems and constantly seeking out new challenges to advance my skills👨🏼💻
constresponseOne=awaitmethodOne();if(responseOne.error)returnconstresponseTwo=awaitmethodTwo();if(responseTwo.error)return// of if you want destructuringconst{error:methodOneError,result:resultOne}=awaitmethodOne();if(methodOneError)returnconst{error:methodTwoError,result:restultTwo}=awaitmethodTwo();if(methodTwoError)return
Im not saying the array descructuring is worse, its just a prefference
A skilled software engineer, talented problem-solver and team player with a passion for using technology to solve complex problems and constantly seeking out new challenges to advance my skills👨🏼💻
A skilled software engineer, talented problem-solver and team player with a passion for using technology to solve complex problems and constantly seeking out new challenges to advance my skills👨🏼💻
Yeah, that is right. But in case of multiple blocks in the same scope it can create issue, as you will not be able de-structure it like this
But in case of array, you can use other variable name in the second method call.
Feel free to correct me, if I am missing something.
a few ways you could avoid this:
Im not saying the array descructuring is worse, its just a prefference
You can rename the variable when destructuring an object.
@jsnanigans Yeah, It's just a preference.
@erikhofer I am aware of that.