Es6 Module
Export-Import in ES6 JavaScript's es6 allow you to organize the code components in the form of modules and can be import them into other modules. This makes code maintenance easier. If they are written in separate files. With the help of import and export keywords, Modules can be used in other programs. Using Export You can export a function or variable from any file. Let us create a file named employee.js, and fill it with the things we want to export. There are two types of exports: 1. Named and 2. Default. Named exports must be enclosed using curly braces. Default exports do not. Named Exports You can create named exports two ways. 1. In-line individually, or 2. All at once at the bottom. MOVETOP↑ Example In-line individually: export const empname = "benny" export const empage = 30 // first declare variable and export let empcompany = "xyz" export {empcompany } All at once at the bottom: employeerecord.js // first declare variable and export cons