Animations
API
Arrays
Async
Basics
Challenges
Classes
Console
Dates
Debugging
DOM Elements
DOM Methods
DOM Properties
Event Listeners
Flow Control
Forms
Functions
Global Functions
JSON
Keywords
Libraries (3rd party)
Math
Modules
Objects
Snippets
String
Types
Widgets
Window Object
ES6 (ECMAScript 6) has introduced a mechanism that allows us to build modules natively in JavaScript. We do that with two new keywords, import and export.
Export
is the keyword we use to create the module and make is consumableImport
is the keyword that lets us consume that moduleImport
and Export
expect a list of items to import/export within a set of { }
.type
as module
The import and export keywords allow us to encapsulate our code into a single protected entity. This allows us to control access to the code within too.
We can and will reference our own dependencies internally. We can use it as-needed to keep scope to a minimum.
Module considerations: