How can I split my javascript code into separate files?

前端 未结 3 1796
迷失自我
迷失自我 2021-01-30 18:11

I\'m reading the Javascript Guide from Mozilla And when they contrasted JS to Java , It got me thinking, Java code is easily split up with each class in his own file. after futh

3条回答
  •  野性不改
    2021-01-30 18:23

    You don't need to do anything differently. Just include the script files and they work as if it was a single file.

    Javascript doesn't have file scope. Once the code is parsed it doesn't matter where the code came from.

提交回复
热议问题