Assign an object property of an object to a variable with the same name (browsers behave differently from node)

node

my chrome version is 63.0

excuse me, is this the bug of the browser? The same situation also appears in Firefox

Mar.16,2021

window.name

change name to a variable with a different name, or declare it with let .


window.name is an attribute of that already exists on the window object. This attribute is a string type . When you use var name = a.name , you are actually assigning a value to window.name .
because window.name only accepts values of type string, if the value is not of type string, it is cast to type string.
a.name is an object, so toString.call (a.name, a.name) is called, and the result is '[object Object]', so name becomes '[object Object]'.
in the node environment, name is not a property of the global object, so it can be set normally.

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