Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ES2015
Search
Mark Funk
October 22, 2015
Technology
0
110
ES2015
Mark Funk
October 22, 2015
Tweet
Share
More Decks by Mark Funk
See All by Mark Funk
React, The Virtual DOM, and why State is Evil
mfunkie
5
1.1k
Other Decks in Technology
See All in Technology
株式会社EventHub・エンジニア採用資料
eventhub
0
4.2k
The 5 Obstacles to High-Performing Teams
mdalmijn
0
270
Tech Blogを書きやすい環境づくり
lycorptech_jp
PRO
0
120
Classmethod AI Talks(CATs) #15 司会進行スライド(2025.02.06) / classmethod-ai-talks-aka-cats_moderator-slides_vol15_2025-02-06
shinyaa31
0
170
30分でわかる『アジャイルデータモデリング』
hanon52_
9
2.2k
サーバーレスアーキテクチャと生成AIの融合 / Serverless Meets Generative AI
_kensh
12
3k
【Developers Summit 2025】プロダクトエンジニアから学ぶ、 ユーザーにより高い価値を届ける技術
niwatakeru
2
890
滅・サービスクラス🔥 / Destruction Service Class
sinsoku
6
1.5k
Googleマップ/Earthが一般化した 地図タイルのイマ
mapconcierge4agu
1
200
バックエンドエンジニアのためのフロントエンド入門 #devsumiC
panda_program
16
6.5k
Nekko Cloud、 これまでとこれから ~学生サークルが作る、 小さなクラウド
logica0419
2
730
開発スピードは上がっている…品質はどうする? スピードと品質を両立させるためのプロダクト開発の進め方とは #DevSumi #DevSumiB / Agile And Quality
nihonbuson
1
1.3k
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
400
Code Reviewing Like a Champion
maltzj
521
39k
How STYLIGHT went responsive
nonsquared
98
5.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Become a Pro
speakerdeck
PRO
26
5.1k
Raft: Consensus for Rubyists
vanstee
137
6.8k
Transcript
ES2015 CoffeeScript: The Good Parts
None
<3 Javascript
None
@MarkFunk
ESHarmony
ESHarmony
ES6
ES6
ES2015
ECMASCRIPT
TC39
Annual Releases
ES2016
ES2015
BIG
2008
2011
Favorite Things
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
SCOPE
VAR FUNCTION SCOPING
VAR HOISTING
LET/CONST BLOCK SCOPING
CONST NO REASSIGNMENT
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
New Shorthand
function() { return 1; }
() => { return 1; };
() => 1
myArray.map( (a) => a + 1 );
this.num = 1; myArray.map( (a) => a + this.num );
this.num = 1; myArray.map(function(a) { return a + this.num; }.bind(this));
Default Parameters
const addFn = (a, b=1) => a + b;
const getAge = (ageObj = {}) => { return ageObj.age;
};
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
New Shorthand
const person = { firstName: firstName, lastName: lastName };
const person = { firstName, lastName };
Computed Properties
const person = { name }; person[ageField] = 11; hugPerson(person);
hugPerson({ name, [ageField]: 11 });
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
let myPerson = person; let name = myPerson.name; let age
= myPerson.age; doSomething(name, age);
let { name, age } = person; doSomething(name, age);
let [person1, person2] = people; doSomething(person1, person2);
let [, person2] = people; doSomething(person2);
const fn = ({name, age}) => { doSomething(name, age); }
const fn = ({name = ‘Mr F’, age}) => {
doSomething(name, age); }
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
REST
const add = (…args) => { return args.reduce((a, b) =>
{ return a + b; }, 0); }; add(1, 2, 3, 4, 5);
const [person1, …otherPeople] = people; highFivePerson(person1); winkAtPeople(otherPeople);
SPREAD
let people = [‘bob’, ‘jane’]; const hug = (person1, person2)
=> { // Programmatically hug }; hug(…people);
let people = […cool, …unCool];
const logArgs = (fn) => { return (…args) => {
console.log(…args); fn(…args); }; }; const loggedFn = logArgs(myFns); loggedFn(argOne, argTwo);
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
function Dog() { this.sound = ‘woof’; } Dog.prototype.woof = function()
{ console.log(this.sound); }; let fido = new Dog(); fido.woof();
class Dog { constructor() { this.sound = ‘woof’; } woof()
{ console.log(this.sound); } } let fido = new Dog(); fido.woof();
class Animal { this.sound = ‘’; speak() { console.log(this.sound); }
} class Dog extends Animal { constructor() { super(); this.sound = ‘woof’; } } let fido = new Dog(); fido.speak();
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
String Concatenation
let cartMessage = “There are “ + items + “
items in your cart”; console.log(cartMessage);
let cartMessage = [ “There are”, items, “items in your
cart” ].join(“ “); console.log(cartMessage);
let cartMessage = `There are ${items} items in your cart`;
console.log(cartMessage);
let cartMessage = `There are ${redItems + blueItems} items in
your cart`; console.log(cartMessage);
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
None
const Animals = require(‘Animals’); let fido = new Animals.Dog(); let
fry = new Animals.Cat(); module.exports = { fido, fry };
const {Dog, Cat} = require(‘Animals’); let fido = new Dog();
let fry = new Cat(); module.exports = { fido, fry };
import {Dog, Cat} from ‘Animals’; let fido = new Dog();
let fry = new Cat(); export fido; export fry;
import {Dog as D, Cat} from ‘Animals’; let fido =
new D(); let fry = new Cat(); export default { fido, fry };
import {Dog as D, Cat} from ‘Animals’; let fido =
new D(); let fry = new Cat(); export default { fido, fry };
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
Favorite Things
https://ponyfoo.com/articles/es6
https://kangax.github.io/compat-table/es6/
Transpiler
None
Brave
LET/CONST & FUNCTIONS & OBJECTS & DESTRUCTURING & REST/SPREAD &
CLASSES & TEMPLATES & MODULES
let { className, icon, ...props } = this.props; const iconClass
= `${className} icon icon-${icon}`; return <i className={iconClass} {...props} />;
let newObj = { …obj };
ES2015
Thanks. @MarkFunk