I agree that the syntax for that is really confusing. Every time I write it, I have to check to make sure I'm putting things in the right place.
It gets even more confusing when you also rename properties:
const { foo: bar = 120 } = baz
What it does is essentially:
const bar = baz.foo === undefined : 120 ? baz.foo
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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 agree that the syntax for that is really confusing. Every time I write it, I have to check to make sure I'm putting things in the right place.
It gets even more confusing when you also rename properties:
What it does is essentially: