es6



es6

0 0


es6

ES6 slides and description

On Github mtthomas / es6

ES6

Matt Thomas

6-23-2016

Introduction

  • Matt Thomas
  • 2+ years at Centare
  • Front-End Developer

JavaScript

June 1995 Brendan Eich creates JS in 10 days June 1997 ECMAScript 1 June 1998 ECMAScript 2 December 1999 ECMAScript 3 December 2009 ECMAScript 5

ECMAScript 6

  • June 2015
  • Designed for modern applications
  • New features
  • Simplifies development
  • Similar to .Net/Java
  • Lack of browser support

var

function functionScope(){
  for(var index = 0; index < 10; index += 1){
    //execute logic
  }

  //index is scoped to the function
  var newIndex = index - 10;
}
    

variables are scoped to the nearest function

let

function blockScope(){
  for(let index = 0; index < 10; index += 1){
    //execute the same logic
  }

  //ERROR: index is scoped/contained to the for loop
  let newIndex = index - 10;
}
  

variables are scoped to the nearest block

const

function usingConst(){
  const message = "Success"

  const messages = {
    success: "Success",
    error: "Error"
  }

  //ERROR: message is constant
  message = "Error"

  //VALID: const is not recursive
  messages.success = "Error"
}

not recursive

ES6 Matt Thomas 6-23-2016