Created
July 17, 2015 06:12
-
-
Save wilk/70980956f4c77cc9d120 to your computer and use it in GitHub Desktop.
ES6 Module
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
// file js/myModule.js | |
export function sum(x, y) {return x + y} | |
export const ADDENDUM = 10 | |
// file yourModule.js | |
import * as myModule from "js/myModule" | |
import {sum, ADDENDUM} from "js/myModule" | |
console.log(myModule.sum(10, 20)) // 30 | |
console.log(sum(ADDENDUM, ADDENDUM)) // 20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment