Js interview questions [0] = [0] [0] = 0 {} = = 0, what are the results of these three and why?

Baidu can"t find it directly, maybe it has something to do with its search mechanism, so come here to ask which god to answer, thank you very much

Mar.10,2021

Let me answer separately:

  • [0] = = [0] is false because the addresses of the two arrays are different
  • [0] = = 0 is true , [0] will first change to the original value, that is,'0' = = 0
  • {} = = 0 will report an error, because if you write this directly on the browser console, {} is treated by as an empty code block , not an object, and the last execution is actually = = 0 . If you write ({} = = 0) , it is false .

check the js equality operation rules

equality operator, to put it simply:

  1. Type conversion occurs when the type is different;
  2. addresses are compared when they are of the same type and when objects (including arrays, etc.) are reference types.
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-1b3bbea-2c29c.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-1b3bbea-2c29c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?