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
製造業の課題解決に向けた機械学習の活用と、製造業特化LLM開発への挑戦
knt44kw
0
140
Bet "Bet AI" - Accelerating Our AI Journey #BetAIDay
layerx
PRO
4
1.1k
Datasets for Critical Operations by Dataform
kimujun
0
150
alecthomas/kong はいいぞ
fujiwara3
6
1.3k
Unson OS|48時間で「売れるか」を判定する AI 市場検証プラットフォーム
unson
0
160
AIに全任せしないコーディングとマネジメント思考
kikuchikakeru
0
370
解消したはずが…技術と人間のエラーが交錯する恐怖体験
lamaglama39
0
160
SAE J1939シミュレーション環境構築
daikiokazaki
1
200
完璧を目指さない小さく始める信頼性向上
kakehashi
PRO
0
130
地域コミュニティへの「感謝」と「恩返し」 / 20250726jawsug-tochigi
kasacchiful
0
120
Perlアプリケーションで トレースを実装するまでの 工夫と苦労話
masayoshi
1
330
【CEDEC2025】現場を理解して実現!ゲーム開発を効率化するWebサービスの開発と、利用促進のための継続的な改善
cygames
PRO
0
640
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Building Adaptive Systems
keathley
43
2.7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
Designing for Performance
lara
610
69k
Adopting Sorbet at Scale
ufuk
77
9.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
[RailsConf 2023] Rails as a piece of cake
palkan
56
5.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Scaling GitHub
holman
461
140k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
The Cult of Friendly URLs
andyhume
79
6.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
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