0 votes
1 view
in Web Technology by (47.8k points)

Is there something in JavaScript similar to @import in CSS that allows you to include a JavaScript file inside another JavaScript file?

1 Answer

0 votes
by (107k points)

After the release of ES6 Module, it becomes very easy to include a JavaScript file in another JavaScript file you can do this by the following way:-

Below is the code that shows how to include A JavaScript file to another one.

export function abc() { 

return "abc";


import { abc } from 'module';

 let val = abc(); 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !