Javascript multiple assignment statement

前端 未结 6 1950
小鲜肉
小鲜肉 2021-01-03 10:28

I saw that line in some code

window.a = window.b = a;

How does it work?

Does the following always return true?

win

6条回答
  •  没有蜡笔的小新
    2021-01-03 11:20

    Same as:

    window.b = a;
    window.a = a;
    

    And no, window.a and a is not always equal. Typically it is only equal on the global scope in a web browser JavaScript interpreter.

提交回复
热议问题