如何访问另一个js文件中定义的JS数组 [英] how to access js array defined in another js file

查看:1092
本文介绍了如何访问另一个js文件中定义的JS数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么可以访问哪些是另一个JavaScript文件中定义的JavaScript数组

how i can access an javascript array which is defined in another javascript file

推荐答案

如果变量是全球性的,你包括与可变首次在HTML文件JS文件,那么它是通过第二JS文件访问:

If the variable is global, and you include the JS file with the variable first in your HTML file, then it is accessible via the second JS file:

<script type="text/javascript" src="somefile_with_variable.js"/>
<script type="text/javascript" src="somefile_reading_variable.js"/>

这篇关于如何访问另一个js文件中定义的JS数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆