How to Include a JavaScript File in another JavaScript FileTopic: Answer: Use the export and import StatementSince ECMAScript 6 (or ES6) you can use the export or import statement in a JavaScript file to export or import variables, functions, classes or any other entity to/from other JS files.For example, let's suppose you've two JavaScript files named 'main.js' and 'app.js' and you want to export some variables and functions from 'main.js' to 'app.js'. Then in 'main.js' file you need to write the export statement ( line no-9) as shown in the following example.