1Default Parameters in ES6.
2Template Literals in ES6.
3Multi-line Strings in ES6.
4Destructuring Assignment in ES6.
5Enhanced Object Literals in ES6.
6Arrow Functions in ES6.
7Promises in ES6.
8Block-Scoped Constructs Let and Const.
1// otherApp.js
2import {sum, pi} from "lib/math";
3alert("2π = " + sum(pi, pi));
1// app.js
2import * as math from "lib/math";
3alert("2π = " + math.sum(math.pi, math.pi));
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 ln, {pi, e} from "lib/mathplusplus";
3alert("2π = " + ln(e)*pi*2);
1// lib/math.js
2export function sum(x, y) {
3 return x + y;
4}
5export var pi = 3.141593;