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
これからのJavaScriptの話 そしてES7へ・・・ / JavaScript in Fu...
Search
Shogo Sensui
September 29, 2015
Technology
0
380
これからのJavaScriptの話 そしてES7へ・・・ / JavaScript in Future
2015年9月29日に行われた第60回HTML5とか勉強会の「これからのJavaScriptの話 そしてES7へ・・・」のセッションの資料です。
Shogo Sensui
September 29, 2015
Tweet
Share
More Decks by Shogo Sensui
See All by Shogo Sensui
三年間の関わりから見る PR TIMES エンジニアリングの変化 / Transition of PRTimes Engineering
1000ch
0
100
EU のデジタル市場法と Apple / DMA and Apple
1000ch
0
87
Web Share API
1000ch
0
100
2023 年の Web 開発のベースライン / Web Development Baseline 2023
1000ch
0
32
開発生産性と組織 / Productivity and Organization
1000ch
0
1.1k
なぜ私達は働くのか / Why We Work?
1000ch
0
54
新しいメルカリ Web とそのパフォーマンス / The New Mercari Web and its performance
1000ch
0
54
Web Standards Interop 2022
1000ch
0
280
パフォーマンスを高める CSS / Performance Optimized CSS
1000ch
1
770
Other Decks in Technology
See All in Technology
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
180
C++26 エラー性動作
faithandbrave
2
680
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
1
230
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
2
240
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
1
110
UI State設計とテスト方針
rmakiyama
2
320
podman_update_2024-12
orimanabu
1
260
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Fireside Chat
paigeccino
34
3.1k
Six Lessons from altMBA
skipperchong
27
3.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
4 Signs Your Business is Dying
shpigford
181
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
94
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.3k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Optimising Largest Contentful Paint
csswizardry
33
3k
Transcript
͜Ε͔ΒͷJavaScriptͷ ͦͯ͠ES7ɾɾɾ ୈ60ճ HTML5ͱ͔ษڧձ by 1000ch
1000ch
Profile CyberAgent, Inc. Software Engineer HTMLͱ͍Webٕज़શൠ iOS + Mac
ECMAScriptͱJavaScript
JavaScriptര 1995 Brendan Eichࢯ͕։ൃ Netscape Navigatorʹࡌ ͜ͷલੜ20पΛܴ͑ͨ
Brendan Eich Java͕ྲྀߦͬͯΔ͔Β JavaScriptʹ͠Α͏
ECMAScript ཚཱ͢ΔJS࣮ͷ౷Ұʹ͚ͯ ECMAͷTC39ͱ͍͏νʔϜͰࡦఆ ECMA-262ͱ͍͏จॻͰཧ
ECMAScript ActionScript JScript JavaScript
ࡢࠓͷJavaScript…
Node.jsͷ಄ αʔόʔαΠυϓϩάϥϜͱͯ͠ ϑϩϯτΤϯυͷϏϧυڥͱͯ͠ JSܦݧऀ͕औ͖ͬқ͘ಈ࡞ߴ
WebͷϦονԽ ϒϥβͰग़དྷΔ͜ͱ૿͑͗͢ ඞવతʹJSͰΔ͜ͱ͕૿͑Δ
ʊਓਓਓਓਓਓਓਓਓਓਓਓʊ ʼɹJavaScriptϑΟʔόʔɹʻ ʉY^Y^Y^Y^Y^Y^Y^Y^Y^Y^Yʉ
WebΞϓϦͷߴԽ ࣮ߦڥͷଟذԽʹ͍ ߋͳΔਐԽΛٻΊΒΕ͍ͯΔ
ES5
ES5 ES6 ES7
ES5 ES6 ES7 200912݄ࡦఆ
ES5 ECMAScript 5th edition 20116݄ʹΞοϓσʔτͰ5.1ʹ “use strict”Array.prototypeͷ֦ு
ES2015
ES5 ES6 ES7 200912݄ࡦఆ
ES5 ES6 ES7 20156݄ࡦఆ 200912݄ࡦఆ
ES2015 ECMAScript 6th edition 2009ҎདྷͷେܕΞοϓσʔτ Β͘·Ε͖ͯͨػೳՃ
ES2015 Syntax
let + const { let string = 'Lorem Ipsum'; }
console.log(string); // => string is not defined const PI = 3.14; PI = 3.1415; // => PI has already been declared
class class Cat { constructor(name) { this.name = name; }
meow() { console.log('meow'); } } new Cat('1000ch').meow(); // => meow
Arrow Function let double = function(number) { return number *
2; }; double = (number) => { return number * 2; }; double = number => number * 2;
Default Parameters const process = (params = {}) => {
console.log(params); }; process({ edition: 6 }); // => { edition: 6 } process(); // => {}
Array Rest + Spread const process = (...params) => {
console.log(params); }; process(1); // => [1] process(1, 2, 3); // => [1, 2, 3] let array = [100, 1000, 1000]; let spread = [1, 10, ...array]; console.log(spread); // [1, 10, 100, 1000, 1000]
import + export // export.js export const PI = 3.14;
export let foo = 'bar'; export default class Baz { constructor() { // ... } }; // import.js import Baz, { PI, foo } from './export';
Destruction const ARRAY = [1, 10, 100]; let [one, ten]
= ARRAY; console.log(one, ten); // => 1, 10 const OBJECT = { foo: 1, bar: 10, baz: 100 }; let {foo, baz} = OBJECT; console.log(foo, baz); // => 1, 100
Template Strings let width = 3; let height = 4;
let message = `area is ${width * height}`; console.log(message); // => area is 12
ES2015 Globals
Promise fetch('...').then(function (response) { return response.json(); }).then(function (json) { console.log(json);
}).catch(function (error) { console.log(error); });
Proxy + Reflect let proxied = new Proxy({}, { get:
function(target, name) { return Reflect.get(target, name); }, set: function(target, name, value, receiver) { console.log(`${name} setter is called`); Reflect.set(target, name, value, receiver); } }); proxied.foo = 100; // => foo setter is called console.log(proxied.foo); // => 100
Set + WeakSet let array = []; let object =
[]; let set = new Set(); set.add('string value'); set.add(object); console.log(set.has(array)); // => false console.log(set.has(object)); // => true
Map + WeakMap let array = []; let object =
[]; let map = new Map(); map.set(array, 'value for array'); map.set(object, 'value for object'); console.log(map.get(array)); // => value for array console.log(map.get(object)); // => value for object
Symbols let key1 = Symbol('foo'); let object = {}; object[key]
= 'value for key1'; console.log(object['foo']); // => undefined console.log(object[key1]); // => value for key1 console.log(Object.keys(object)); // => []
ES2016
ES5 ES6 ES7 20156݄ࡦఆ 200912݄ࡦఆ
ES5 ES6 ES7 20156݄ࡦఆ 200912݄ࡦఆ 2016ࡦఆ?
ECMAScript 7th edition ES2016 Highly Experimental !!!
ES2016 Proposals
Exponentiation let squared = 2 ** 2; // same as:
2 * 2 let cubed = 2 ** 3; // same as: 2 * 2 * 2 let a = 2; a **= 2; // same as: a = a * a; let b = 3; b **= 3; // same as: b = b * b * b;
SIMD (Stage var s1 = SIMD.Float32x4(1, 2, 3, 4); var
s2 = SIMD.Float32x4(1, 2, 3, 4); var s3 = SIMD.Float32x4(2, 4, 6, 8); console.log(s1 === s2); // => true console.log(SIMD.Float32x4.add(s1, s2) === s3); // => true
Async Functions (Stage 2 fetch('...').then(function (response) { return response.json(); }).then(function
(json) { console.log(json); }).catch(function (error) { console.log(error); }); try { let response = await fetch('...'); let json = await response.json(); console.log(json); } catch (error) { console.log(error); }
Object Rest + Spread (Stage 2 let { x, y,
...z } = { x: 1, y: 2, a: 3, b: 4 }; x; // 1 y; // 2 z; // { a: 3, b: 4 } let n = { x, y, ...z }; n; // { x: 1, y: 2, a: 3, b: 4 }
Decorators (Stage 1 function enumerable(value) { return function (target, key,
descriptor) { descriptor.enumerable = value; return descriptor; } } class Foo { @enumerable(false) bar() { } @enumerable(true) baz() { } }
Compatibility…
ECMAScript Compatibility Table
WebKit Web Platform Status ECMAScript 6 support in Mozilla Chrome
Platform Status Microsoft Edge Platform status
Babel
Traceur Compiler
͓ΘΓ + +ShogoSensui " # 1000ch 1000ch