FITC events. For digital creators.
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
An Intro To ES6
with Grant Skinner
OVERVIEW
ECMAScript 6 is the approved and published standard for the next version of JavaScript. It offers new syntax and language features that provide new ways of tackling coding problems, and increase your productivity.
This session will introduce ES6 and delve into many of the new features of the language. It will also cover real-world use, including transpilers, runtimes, and browser support.
OBJECTIVE
Create confidence in evaluating and getting started using ES6.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
JavaScript.
FOUR THINGS AUDIENCE MEMBERS WILL LEARN
Status of ES6
How to get started with ES6
ES6 feature overview
Practical considerations for adopting ES6
51. var str = "template";
var tstr = `${str} ${typeof str}s rock!`;
// "template strings rock!"
52. var foo = `hello there ${name}.
Welcome to ${getLocation()},
we hope you enjoy your stay!`;
53. var foo = `hello there ${name}.
Welcome to ${getLocation()},
we hope you enjoy your stay!`;
54. class Foo {
function bar() {
var foo = `hello there ${name}.
Welcome to ${getLocation()},
we hope you enjoy your stay!`;
}
}
55. var _ = "n";
var foo =
`hello there ${name}.${_
}Welcome to ${getLocation()},${_
}we hope you enjoy your stay!`;
56. function dedent(str) {
var lines = str.split("n");
var indent = lines[1].match(/^s+/);
if (!indent) { return str; }
var r = new RegExp("^"+indent);
lines.forEach((v,i,a)=>a[i]=v.replace(r,""));
return lines.join("n");
}
var foo = dedent(`hello there ${name}.
Welcome to ${getLocation()},
we hope you enjoy your stay!`);
76. function scale(scaleX=1, scaleY=scaleX) {
// etc.
}
function rotate(angle=Math.random()*360) {
// etc.
}
function translate(x=this.tx, y=this.ty) {
// etc.
}
105. ES6 is here, and you should learn it.
You can learn and apply it iteratively.
Use a transpiler for client-side code.
Most features are syntactic sugar, but still nice.
Use them responsibly!
A few new bits too, but wait to use them.