Why are arrays stored in the variable "name" in converting Chrome to strings?

When I launch var name = [1,2,3]in the Chrome console and then access the value name, I return "1,2,3". Why is this so?

enter image description here

+4
source share
1 answer

What you see is a global variable that is part of an object window. This is actually the value that the browser uses that reflects the name of the window. (see documentation )

window.name - getter/setter, . ( " ", var name window.name - . ( , , )

+7

Source: https://habr.com/ru/post/1599435/


All Articles