eightminuseight icon

Imports Examples

eightminuseight | PRO | 10/05/16 07:41:31 PM UTC | 0 ⭐ | 210 👁️ | Never ⏰ | []
JavaScript |

770 B

|

None

|

0 👍

/

0 👎

// Import a single export from a module
import { ZipCodeValidator } from "./ZipCodeValidator";
let myValidator = new ZipCodeValidator();
 
 
// imports can also be renamed
import { ZipCodeValidator as ZCV } from "./ZipCodeValidator";
let myValidator = new ZCV();
 
 
// Import the entire module into a single variable, and use it to access the module exports
import * as validator from "./ZipCodeValidator";
let myValidator = new validator.ZipCodeValidator();
 
 
 
// Import a module for side-effects only
// Though not recommended practice, some modules set up some global state that can be used 
// by other modules. These modules may not have any exports, or the consumer is not interested 
// in any of their exports. To import these modules, use:
import "./my-module.js";

Comments