-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodule.js
More file actions
38 lines (31 loc) · 937 Bytes
/
module.js
File metadata and controls
38 lines (31 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// This is export of variable.
export let one = 1;
// This is export of variables.
let two = 2;
let three = 3;
export { two, three }
// This is export of class.
export class SomeClass {
constructor(someProp) {
this.someProp = someProp;
}
}
// This is export of class.
export function someFunc() {
console.log("Some text");
}
// This is export of class or function in the end of file.
// export { SomeClass, someFunc }
// export { SomeClass as MyClass, someFunc as myFunc }
// This is import of class or function in the end of file.
// import { SomeClass, someFunc } from "./file.js"
// import { SomeClass as MyClass, someFunc as myFunc } from "./file.js"
// import * as SomeObjects from "./file.js"
// This is export of default class.
export default class NewClass {
constructor(someProp) {
this.someProp = someProp;
}
}
// This is import of default class.
// import NewClass from "./file.js";