[removed] Scope of a Variable across different Javascript files

后端 未结 3 1514
滥情空心
滥情空心 2020-12-16 22:21

I defined a variable in one of my JavaScript files. I want to access the value of that variable among JavaScript files. In one file I am initializing the value of that varia

3条回答
  •  鱼传尺愫
    2020-12-16 23:00

    You should be able to access them if they are in the global scope or can be accessed from the global scope.

    For example, I have a object literal like this in my HTML in a script element...

    
    

    Which I can access in any other subsequent JavaScript file with config.basePath.

提交回复
热议问题