ECMAscript 6
May. 1st, 2014 01:24 pmGood stuff
https://github.com/lukehoban/es6features
https://github.com/lukehoban/es6features
var odds = evens.map(v => v + 1) GET`http://foo.org/bar?a=${a}&b=${b} Content-Type: application/json X-Credentials: ${credentials} { "foo": ${foo}, "bar": ${bar}}`(myOnReadyStateChangeHandler) var [a, , b] = [1,2,3] function f(x, y=12) { return x + y } f(3) == 15 function f(x, ...y) { return x * y.length } f(3, "hello", true) == 6 const x = "dont change me" var arr = [] for (var i = 10; l--;) { let j = i result[i] = function() { return j } } arr[5]() === 5 arr[6]() === 6 var cat = 'Pavlova' var dog = 'Charlie' var pets = {cat, dog} var s = new Set() s.add("hello").add("goodbye").add("hello") s.size === 2 s.has("hello") === true var squares = [ x*x for (x of [1,2,3,4,5]) if (x % 2 == 1) ] "abc".repeat(3).contains("cabca") // tail call function factorial(n, acc = 1) { 'use strict'; if (n <= 1) return acc; return factorial(n - 1, n * acc); } factorial(100000) this one says "too much recursion