Questions about the cast of js empty object types in Chrome

when an empty object is summed with another data, such as

{} + []
The empty object in front of

is generally treated as an empty block of code and becomes

+ [] // 0

so when empty objects and empty objects are summed

{} + {}

an empty object is treated as a code block is equal to

+ {}

the result should be NaN.

but in Chrome

{} + {} // "[object Object][object Object]"

obviously the first empty object is not treated as a code block.

in other browsers such as Firefox or IE

{} + {} 

the results are all NaN.

I don"t quite understand why it is different in

Chrome.

Apr.20,2022

because {} + {} has different parsing methods

  1.    {
       }
       +{}

    is preceded by an empty code block

  2. is parsed as an object before and after, and finally, the respective toString methods are called to concatenate strings
  3. .

to avoid the above ambiguity, you can use ({} + {}) to achieve consistency

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf3f31-4644b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf3f31-4644b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?