-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport.js
More file actions
37 lines (29 loc) · 742 Bytes
/
Copy pathexport.js
File metadata and controls
37 lines (29 loc) · 742 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
// In javascript, the way you get code from other files
// is that you export it
// let myVariable = 942;
// let func1 = () => {
// console.log('Hello from func1');
// }
//
// let func2 = () => {
// console.log('Hello from func2');
// }
//
// // old way
// // we could have even done without declaring variables globally
// // and instead do everything within the object
// module.exports = {
// myVar: myVariable,
// func1: func1,
// func2: func2
// };
//ES6
export let myVariable = 942;
export let func1 = () => {
console.log('Hello from func1');
}
export let func2 = () => {
console.log('Hello from func2');
}
// Say this file was a class, we would at the bottom of the file add this line
// export default className;