상세 컨텐츠

본문 제목

How To Include A Js File In Html

카테고리 없음

by renfcorgatuc1972 2020. 3. 6. 16:58

본문

IncludeHow To Include A Js File In HtmlHtml external javascript file

How To Add A Js File In Html

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.