Created
December 10, 2014 20:24
-
-
Save devdays/3733497c97d6991fd91a to your computer and use it in GitHub Desktop.
Object JavaScript Modules - named exports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in lib/math.js | |
let notExported = 'abc'; | |
export function square(x) { | |
return x * x; | |
} | |
export const ONE_TWO_THREE = 123; | |
// in main1.js | |
import {square} from 'lib/math'; | |
console.log(square(3)); | |
// in main2.js | |
import as match from 'lib/math'; | |
console.log(math.square(3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment