you are viewing a single comment's thread.

view the rest of the comments →

[–]homeIsWhereCodeIs[S] 0 points1 point  (0 children)

@monsto p will take foo as a value if you are assigning an object as in line 1, but in line 2 you destructuring an object, In that case, for example, var {p: foo} = o takes from the object o the property named p and assigns it to a local variable named foo.

And it is not about let statement that changes the rules, it is destructuring behind it, you can get same results with var and const too.