-3

If I have an HTML document with one external JS file attached (I would like to keep it to one) [let's say the file is called index.js] is there a way to link other javascript files from within the index.js file so that the other JS files would also be included?

example structure:

/index.html
/index.js
/other-js-file.js
/another-js-file.js

So here's what I'd like to do inside of index.js:

include/import/something-like-that "other-js-file.js"
include/import/something-like-that "another-js-file.js"

function xyz(){
  //do stuff..
}

so that my project could access all of the functions in all of the different files. I am trying to keep the code from the JS files in smaller files for easier maintenance. I'd also like to do this to avoid having a huge list of JS files in my HTML document.

Any suggestions? Thanks!

1 Answers1

-1

An import statement should do just fine