Hi, i was going through the types and Grammer , Chapter 5. I found this wrong while executing as a code.
{} + [] gives the same as [] + {} which is "[object Object]", but book reports differently to both the cases.
Chrome console returned this:
You put both into a console.log() statement, which makes both of them expressions, so yes they will be the same.
The point of the book section in question is when they're in statement positions (as shown by @KirankumarAmbati), the {}
is taken as a separate block statement when it's at the beginning.
hey @getify , thanks for clearing the confusion.@Kiran thanks for the timely response. It is correct
Most helpful comment
hey @getify , thanks for clearing the confusion.@Kiran thanks for the timely response. It is correct