Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Whats New In EcmaScript 2015 / ES6
Search
Hans Kristian Flaatten
January 28, 2016
Technology
78
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Whats New In EcmaScript 2015 / ES6
Hans Kristian Flaatten
January 28, 2016
More Decks by Hans Kristian Flaatten
See All by Hans Kristian Flaatten
Continuous Deployment with Jenkins Pipelines
starefossen
0
63
Continuous Integrations with Jenkins
starefossen
0
72
Testing Node.js
starefossen
0
35
What is Node.js?
starefossen
0
47
LeftPad Not Found
starefossen
0
91
Experience with NoSQL at the Norwegian Trekking Asocciation
starefossen
0
55
Introduction to Geospatial Queries in MongoDB
starefossen
0
42
Åpen Tur- og Friluftsdata
starefossen
0
110
Reverse Engineering APIs from iOS and Android Apps
starefossen
0
71
Other Decks in Technology
See All in Technology
AI coding 整合正規方法
philipz
0
380
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
220
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
140
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
150
Reactの設計論
uhyo
24
14k
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
330
SREへの勘違いに気づいた後の話
tomodakengo
0
110
.NET WebAssemblyで実現するクライアントサイドAI推論:NuGetからViteまで、2つのエコシステムを繋ぐビルド戦略
yamachu
0
260
銀行勘定系システムにおける開発プロセス刷新×AIによる環境モダナイゼーション / Development Process Transformation and AI-Driven Environment Modernization
muit
1
2.4k
ソフトウェアDNAとクラウドエージェントのススメ
cloudace
0
120
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
3
560
品質と信頼性を地続きにする
grimoh
2
820
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Between Models and Reality
mayunak
4
460
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Claude Code のすすめ
schroneko
67
230k
Code Review Best Practice
trishagee
74
20k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
A better future with KSS
kneath
240
18k
Transcript
ECMAScript 6 Hans Kristian Flaatten 1 Bergen Linux User Group
Torsdag 28. januar 2016 Bergen Offentlige Bibliotek
ES6 Hans Kristian Flaatten 2 Bergen Linux User Group Torsdag
28. januar 2016 Bergen Offentlige Bibliotek
ECMAScript 2015 Hans Kristian Flaatten 3 Bergen Linux User Group
Torsdag 28. januar 2016 Bergen Offentlige Bibliotek
JavaScript ≠ ECMAScript 4
• arrows functions • classes • enhanced object literals •
template strings • destructuring • default + rest + spread • let + const • iterators + for..of • generators • unicode • modules • module loaders • map + set + weakmap + weakset • proxies • symbols • subclassable built-ins • promises • math + number + string + array + object APIs • binary and octal literals • reflect api • tail calls 5
Block Scopes 6 (function () { var food = 'Meow
Mix'; }()); console.log(food); // Reference Error
Block Scopes 7 { let food = 'Meow Mix'; }
console.log(food); // Reference Error
Arrow Functions 8 function Person(name) { this.name = name; }
Person.prototype.prefixName = function (arr) { return arr.map(function (character) { return this.name + character; // Cannot read property 'name' of undefined }); };
Arrow Functions 9 function Person(name) { this.name = name; }
Person.prototype.prefixName = function (arr) { var that = this; // Store the context of this return arr.map(function (character) { return that.name + character; }); };
Arrow Functions 10 function Person(name) { this.name = name; }
Person.prototype.prefixName = function (arr) { return arr.map(character => this.name + character); };
Arrow Functions 11 var arr = [1, 2, 3, 4,
5]; var squares = arr.map(function (x) { return x * x });
Arrow Functions 12 var arr = [1, 2, 3, 4,
5]; var squares = arr.map(x => x * x);
Template Strings 13 var name = 'Tiger'; var age =
10; console.log('My name is ' + name + ', I am ' + age + ' years');
Template Strings 14 let name = 'Tiger'; let age =
10; console.log(`My name is ${name} and I am ${age} years.`);
Multiline Template Strings 15 var text = ( 'cat\n' +
'dog\n' + 'nickelodeon' );
Multiline Template Strings 16 var text = [ 'cat', 'dog',
'nickelodeon' ].join('\n');
Multiline Template Strings 17 let text = `cat dog nickelodeon`;
Destructing Arrays 18 var arr = [1, 2, 3, 4];
var a = arr[0]; var b = arr[1]; var c = arr[2]; var d = arr[3];
Destructing Arrays 19 let [a, b, c, d] = [1,
2, 3, 4]; console.log(a); // 1 console.log(b); // 2
Destructing Arrays 20 var luke = { occupation: 'jedi', father:
'anakin' }; var occupation = luke.occupation; // 'jedi' var father = luke.father; // 'anakin'
Destructing Arrays 21 let luke = { occupation: 'jedi', father:
'anakin' }; let {occupation, father} = luke; console.log(occupation); // 'jedi' console.log(father); // 'anakin'
Default Function Parameters 22 function addTwoNumbers(x, y) { x =
x || 0; y = y || 0; return x + y; }
Default Function Parameters 23 function addTwoNumbers(x=0, y=0) { return x
+ y; } addTwoNumbers(2, 4); // 6 addTwoNumbers(2); // 2 addTwoNumbers(); // 0
Named Function Parameters 24 function drawES5Chart(options) { options = options
=== undefined ? {} : options; var size = options.size === undefined ? 'big' : options.size; var cords = options.cords === undefined ? { x: 0, y: 0 } : options.cords; var radius = options.radius === undefined ? 25 : options.radius; console.log(size, cords, radius); // now finally do some chart drawing } drawES5Chart({ cords: { x: 18, y: 30 }, radius: 30 });
Named Function Parameters 25 function drawES6Chart({ size: size = 'big',
cords: cords = { x: 0, y: 0 }, radius: radius = 25 } = {}) { console.log(size, cords, radius); // do some chart drawing } drawES6Chart({ cords: { x: 18, y: 30 }, radius: 30 }); // 'big' {x: 18, y: 30} 30
Generators 26 function* fibonacci(){ let val1 = 0, val2 =
1, swap; yield val1; yield val2; while (true){ swap = val1 + val2; val1 = val2; val2 = swap; yield swap; } }
Generators 27 var sequence = fibonacci(); sequence.next().value // 0 sequence.next().value
// 1 sequence.next().value // 1 sequence.next().value // 2 sequence.next().value // 3 sequence.next().value // 5 sequence.next().value // 8
Browser Support 28 Browser ECMAScript 6 Support Google Chrome 91
% Edge 83 % FireFox 85 % Safari 54 % Kilde: https://kangax.github.io/compat-table/es6/
Node.js ES6 Support 29 0 25 50 75 100 v0.10
(3.14) v0.12 (v8 3.28) v4 (v8 4.5) v5 (v8 4.6) v6 (v8 5.0)
30
ECMAScript 7 ?! 31
ECMAScript 7 32
ECMAScript 2016 33