How to know variables from different…“namespaces”?

前端 未结 3 925
离开以前
离开以前 2021-01-29 08:40

How can I reach some variable declared in another place from within an external javascript file ?

Suppose in an html file I have the following



        
3条回答
  •  情深已故
    2021-01-29 09:20

    when a variable is defined without var it is said to exist in global scope. When your JS is loaded into your page, it is aware of any variables that exist globally at that time. So, what google is doing is defining some variables and then loading in an external script.

提交回复
热议问题