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
A2Aのクライアントを自作する
rynsuke
1
170
PostgreSQL 18 cancel request key長の変更とRailsへの関連
yahonda
0
120
CI/CD/IaC 久々に0から環境を作ったらこうなりました
kaz29
1
160
M3 Expressiveの思想に迫る
chnotchy
0
100
BrainPadプログラミングコンテスト記念LT会2025_社内イベント&問題解説
brainpadpr
1
160
2年でここまで成長!AWSで育てたAI Slack botの軌跡
iwamot
PRO
4
690
AIの最新技術&テーマをつまんで紹介&フリートークするシリーズ #1 量子機械学習の入門
tkhresk
0
130
AIエージェント最前線! Amazon Bedrock、Amazon Q、そしてMCPを使いこなそう
minorun365
PRO
13
5k
データプラットフォーム技術におけるメダリオンアーキテクチャという考え方/DataPlatformWithMedallionArchitecture
smdmts
5
620
AWS Summit Japan 2025 Community Stage - App workflow automation by AWS Step Functions
matsuihidetoshi
1
250
Azure AI Foundryでマルチエージェントワークフロー
seosoft
0
180
GitHub Copilot の概要
tomokusaba
1
130
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
69
11k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Gamification - CAS2011
davidbonilla
81
5.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
GraphQLとの向き合い方2022年版
quramy
47
14k
Adopting Sorbet at Scale
ufuk
77
9.4k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
It's Worth the Effort
3n
185
28k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
490
Art, The Web, and Tiny UX
lynnandtonic
299
21k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
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