1// lib/math.js
2export function sum(x, y) {
3 return x + y;
4}
5export var pi = 3.141593;
1// lib/mathplusplus.js
2export * from "lib/math";
3export var e = 2.71828182846;
4export default function(x) {
5 return Math.log(x);
6}
1// app.js
2import * as math from "lib/math";
3alert("2π = " + math.sum(math.pi, math.pi));
1// app.js
2import ln, {pi, e} from "lib/mathplusplus";
3alert("2π = " + ln(e)*pi*2);
1// otherApp.js
2import {sum, pi} from "lib/math";
3alert("2π = " + sum(pi, pi));