es6 features in javascript
Default Parameters in ES6.
Template Literals in ES6.
Multi-line Strings in ES6.
Destructuring Assignment in ES6.
Enhanced Object Literals in ES6.
Arrow Functions in ES6.
Promises in ES6.
Block-Scoped Constructs Let and Const.
4.25
4
// app.js
import ln, {pi, e} from "lib/mathplusplus";
alert("2π = " + ln(e)*pi*2);
Thank you!
4
0
4.5
4
// lib/mathplusplus.js
export * from "lib/math";
export var e = 2.71828182846;
export default function(x) {
return Math.log(x);
}
Thank you!
4
0
4.22
9
// lib/math.js
export function sum(x, y) {
return x + y;
}
export var pi = 3.141593;
Thank you!
9
0
4.25
4
// otherApp.js
import {sum, pi} from "lib/math";
alert("2π = " + sum(pi, pi));
Thank you!
4
0
3.6
10
// app.js
import * as math from "lib/math";
alert("2π = " + math.sum(math.pi, math.pi));
Thank you!
10
0
Are there any code examples left?
New code examples in category Javascript