DEV Community

ikechukwu1234
ikechukwu1234

Posted on

Modules

JavaScript Modules: You can divide your JavaScript code into various files using modules. This makes maintaining a code base simpler. Modules also rely on the script> tag's type = "module" attribute.

Modules: is just a file, a module.One module is one script. Modules can load one another and employ specialised directives in that manner. To exchange functionality, call functions from one module into another using export and import.

Variables and functions marked with the export keyword should be used outside of the current module.

The import keyword enables the importation of features from other modules.

Common js module:is the original method of packaging JavaScript code for Node.js was using Common J's module.

In Common J's module all of your dependencies for are stored together or in one file called node modules.

ES module: This standard, which debuted with ES6, was introduced in 2015. The goal was to provide these functionality in browsers while standardising how Js modules operate

In ES modules each dependency is stored on it's own files

Top comments (0)