ECMASCRIPT 6

Use next generation JavaScript, today.

BINDINGS

for(let i = 1; i < 10; i++) {
    let foo = "bar";
}
console.log(i);    // undefined
console.log(foo);  // undefined
const FOO = "bar";

LET

CONST

'use strict';

function f() { return 1; }
{
  function f() { return 2; }
}
return f() === 1;

BLOCK LEVEL FUNCTION DECLARATIONS

default function params


function sum(a = 1, b = 2) { 
    return a + b;
};

sum();    // 3
function foo(a = 1, b = a) { // some code }

foo(undefined, 3);

arrow functions

var sum = (x,y) => x+y;
var numbers = [1,2,3,4,5];

var timesTwo = numbers.map((number) => number * 2);

console.log(timesTwo); // [2, 4, 6, 8, 10]

ES6 + Babel

By Subin Varghese

ES6 + Babel

  • 36