Skip to content

Instantly share code, notes, and snippets.

@rene-machel-razorfish
Last active January 21, 2016 20:18
Show Gist options
  • Save rene-machel-razorfish/7015e7d33f1ff0e7e63a to your computer and use it in GitHub Desktop.
Save rene-machel-razorfish/7015e7d33f1ff0e7e63a to your computer and use it in GitHub Desktop.
ES6 Pitch

#ES6, why should we care?

It empowers developers coming from Java or C# or other “higher” languages to finally write JavaScript and bring all the goodness of their experience to a market in dire need of organization and direction.

##Can you actually use ES6?

###Short Answer: Yes Some parts of ES6 can be used with a shim, but others require converting ES6 code into ES5, using a tool such as Traceur or Babel. ES6 has great Features you can start using today, Classes, Arrows, Destructuring, Let+Const, Template Strings... etc.

http://es6-features.org/

https://github.com/lukehoban/es6features

#WHAT?

##We! We as a team should make the move to ES6 on upcoming projects, where it fits, when everybody feels comfortable and agrees to make the move. Therefore let's create an agenda how we can integrate this process into our daily work routine. Mini coding challenges that integrate with trainings on ES6, ressources to follow up, Lynda.com courses Coding Dojo's arround ES6. We should learn from each other, train each other and take interest in how we can transform to write high quality ES6 code.

##Show time

###Destructuring

####ES6

function initialize({controls = {}, models = {}, reducers = {}, actors = []}) {
	// ...
}

####ES5

function initialize(options) {
	var controls = options.controls || {};
    var models = options.models || {};
	var reducers = options.reducers || {};
    var actors = options.actors || {};
}

###for .. of loops

####ES6

for (let [name, builder] of Object.entries(models)) {
	// do something
}

####ES5

var entries = Object.entries(models);
for (var i = 0; i != entries.length; i++) {
	var entry = entries[i];
    var name = entry[0];
	var builder = entry[1];
}

###let

####ES6

// ES6 — let

let a = 1;

if (1 === a) {
	let b = 2; 
}

for (let c = 0; c < 3; c++) {
	// …
}

function letsDeclareAnotherOne() {
	let d = 4;
}

console.log(a); // 1
console.log(b); // ReferenceError: b is not defined
console.log(c); // ReferenceError: c is not defined
console.log(d); // ReferenceError: d is not defined

###const const is single-assignment and like a let, block-scoped declaration.

####ES6 const PI = 3.141593 PI > 3.0

####ES5

//  only in ES5 through the help of object properties
//  and only in global context and not in a block scope
Object.defineProperty(typeof global === "object" ? global : window, "PI", {
	value:        3.141593,
    enumerable:   true,
	writable:     false,
    configurable: false
})
PI > 3.0;

##Learn time

###Lynda.com

###Online ressources

  • ... etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment