Modules and Imports Flashcards
(8 cards)
Which keyword ensures that a JavaScript module’s internal variables/functions cannot be modified from outside the module?
None, as modules inherently provide this encapsulation
In ES6 module syntax, how would you import only specific functions or variables from a module?
import { functionName } from ‘module-name’;
If a module exports multiple items, and one as default, how would you import the default export and a named export simultaneously?
import defaultExport, { namedExport } from ‘module-name’;
What is the purpose of “default” in ES6 module exports?
To specify the primary export of a module
Which keyword is used to export a module in ES6 JavaScript?
export
If a JavaScript module has a default export, how would you import it?
import defaultExport from ‘module-name’;
Which of the following is a way to import everything from a module in ES6?
import * as aliasName from ‘module-name’;
If you see the import … from … syntax in a JavaScript file, what type of module system is it most likely using
ES6 Modules