Why is {} + 'equals 0?

as shown in figure

clipboard.png

preliminary doubt whether the empty string on the right is converted to 0?

Mar.04,2021
The

operator +, when used as a unary operator, converts it to a numeric value if its Operand is not a numeric value.
you may wonder why there is an empty object ({}) in front of + here why it interprets + as a unary operator? Because in this case, the preceding {} is not an empty object, but an empty code block (empty code block).


this is the default conversion of the data type of js. Your suspicion is correct, but it is converted by pulling several js methods in the middle

.
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-1b37d79-2c0c1.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-1b37d79-2c0c1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?