alphabetise features

This commit is contained in:
Sebastian McKenzie 2014-09-30 16:13:21 +10:00
parent a2f2811200
commit 828b9f54e4

View File

@ -1,11 +1,25 @@
# Features
## Array comprehension
```javascript
[for (i of [1, 2, 3]) i * i]; // [1, 4, 9]
```
## Arrow functions
```javascript
arr.map(x => x * x);
```
## Block binding
```javascript
for (let i in arr) {
let v = arr[i];
}
```
## Classes
```javascript
@ -20,6 +34,27 @@ class Foo extends Bar {
}
```
## Computed property names
```javascript
var obj = {
["x" + foo]: "heh",
["y" + bar]: "noo",
foo: "foo",
bar: "bar"
};
```
## Constants
```javascript
const MULTIPLIER = 5;
console.log(2 * MULTIPLIER);
MULTIPLIER = 6; // error
var MULTIPLIER; // error
```
## Default parameters
```javascript
@ -28,25 +63,38 @@ function foo(bar = "foo") {
}
```
## Spread
## Destructuring
```javascript
function add(x, y) {
return x + y;
}
var numbers = [5, 10]
add(...numbers); // 15
var [a, [b], c, d] = ["hello", [", ", "junk"], ["world"]];
console.log(a + b + c); // hello, world
```
## Block binding
## For-of
```javascript
for (let i in arr) {
let v = arr[i];
for (var i of [1, 2, 3]) {
console.log(i * i);
}
```
## Generators
```javascript
```
## Modules
```javascript
```
## Numeric literals
```javascript
0b111110111 === 503; // true
0o767 === 503; // true
```
## Property method assignment
```javascript
@ -67,6 +115,14 @@ var obj = {
};
```
## Property name shorthand
```javascript
function f(x, y) {
return { x, y };
}
```
## Rest parameters
```javascript
@ -78,6 +134,17 @@ function printList(name, ...items) {
};
```
## Spread
```javascript
function add(x, y) {
return x + y;
}
var numbers = [5, 10];
add(...numbers); // 15
```
## Template literals
```javascript
@ -85,63 +152,3 @@ var x = 5;
var y = 10;
console.log(`${x} + ${y} = ${x + y}`); // "5 + 10 = 15"
```
## Modules
```javascript
```
## Numeric Literals
```javascript
0b111110111 === 503; // true
0o767 === 503; // true
```
## For-of
```javascript
```
## Constants
```javascript
```
## Computed property names
```javascript
var obj = {
["x" + foo]: "heh",
["y" + bar]: "noo",
foo: "foo",
bar: "bar"
};
```
## Property name shorthand
```javascript
function f(x, y) {
return { x, y };
}
```
## Array comprehension
```javascript
[for (i of [1, 2, 3]) i * i]; // [1, 4, 9]
```
## Destructuring
```javascript
var [a, [b], c, d] = ["hello", [", ", "junk"], ["world"]];
console.log(a + b + c); // hello, world
```
## Generators
```javascript
```