Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. // exporter1.js
  2. let foo = 1;
  3. export { foo as default }; // exports the foo binding
  4. foo = 2;
  5.  
  6. // exporter2.js
  7. let foo = 1;
  8. export default foo; // creates a new binding named *default* and initializes it to 1.
  9. foo = 2; // assigns to the foo binding which is not exported
  10.  
  11. // importer1.js
  12. import foo from "exporter1.js";
  13. print(foo); // 2
  14.  
  15. // importer2.js
  16. import foo from "exporter2.js";
  17. print(foo); // 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement