What's the difference between [removed] and [removed] in JavaScript?

后端 未结 16 1988
故里飘歌
故里飘歌 2020-11-22 12:37

Should both of them reference the same object?

16条回答
  •  遇见更好的自我
    2020-11-22 13:27

    As far as I know, Both are same. For cross browser safety you can use window.location rather than document.location.

    All modern browsers map document.location to window.location, but I still prefer window.location as that's what I've used since I wrote my first web page. it is more consistent.

    you can also see document.location === window.location returns true, which clarifies that both are same.

提交回复
热议问题