How to know variables from different…“namespaces”?

前端 未结 3 896
离开以前
离开以前 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条回答
  •  -上瘾入骨i
    2021-01-29 09:00

    The script can just assume that those variables will be set. They must be because they are needed. The script can check if they are undefined and fail gracefully (do nothing) when they are not. The variables are not in another namespace.

提交回复
热议问题