On the in window problem

Is there any difference between

an in window and "a" in window?

Mar.16,2021

the first is a variable and the second is a string


the first value of the variable a is an attribute of window , and the second is whether the string "a" is an attribute of window :

clipboard.png


A without quotation marks is a variable, then an in window can be a judgment statement or an assignment statement after for.
while "a" is a string constant, "a" in window can only be a judgment statement.


take a look at the document. Portal

emphasizes the situation of prop in prop in object :

an attribute name or array index of type symbol (non-symbol types will be forced to string).
Menu