Javascript 在普通JS文件中导入

Javascript 在普通JS文件中导入,javascript,import,ramda.js,Javascript,Import,Ramda.js,我正在尽可能地保存我的文件。 因此,在我的html文件中,我有: 然后在我想使用的binarytree\u standardgrid\u script.js文件中:Ramda.js 如何在不使用节点的情况下“导入”Ramda.js或“包含”Ramda.js?还是我真的需要使用node 然后我有另一个文件名为BinaryTree.js 文件结构是 ./index.html ./algorithms/BinaryTree.js ./js/binarytree_stand

我正在尽可能地保存我的文件。 因此,在我的html文件中,我有:


然后在我想使用的
binarytree\u standardgrid\u script.js
文件中:
Ramda.js

如何在不使用节点的情况下“导入”
Ramda.js
或“包含”
Ramda.js
?还是我真的需要使用node

然后我有另一个文件名为
BinaryTree.js

文件结构是

    ./index.html 
    ./algorithms/BinaryTree.js
    ./js/binarytree_standardgrid_script.js
在html文件中,我通过以下方式调用
binarytree\u standardgrid\u script.js

在这个脚本中,我希望能够使用
BinaryTree.js
,然后使用Ramda库


我如何在Javascript中做到这一点?我真的需要使用node吗?

好的,我找到了解决方案:

只需将脚本放在html页面上:

<script src="algorithms/BinaryTree.js"></script>

<script src="http://cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script>

<script src="js/binarytree_standardgrid_script.js"></script>


然后,只要脚本文件不在函数中,这些类和函数就可以在脚本文件中使用。

您可以在自己的脚本之前添加
,如他们网站上所述。看起来该网站最近没有更新。当前版本为0.26.1:。