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
79
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
65
Continuous Integrations with Jenkins
starefossen
0
74
Testing Node.js
starefossen
0
36
What is Node.js?
starefossen
0
48
LeftPad Not Found
starefossen
0
92
Experience with NoSQL at the Norwegian Trekking Asocciation
starefossen
0
57
Introduction to Geospatial Queries in MongoDB
starefossen
0
43
Åpen Tur- og Friluftsdata
starefossen
0
110
Reverse Engineering APIs from iOS and Android Apps
starefossen
0
72
Other Decks in Technology
See All in Technology
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
780
PHPカンファレンス関西の招待状 / Invitation to PHP Conference Kansai
ykanoh
0
140
AI コーディングと人間の認知スループット / CTO Night & Day 2026 Morning Session / AI Coding and Human Cognitive Throughput
prog893
4
1.2k
WasmをRustにする
sansantech
PRO
0
250
Getting Started with Google Antigravity
glaforge
0
310
JAWSUG TOHOKU 青森支部 「LoGoチャット」のAWS移行で 乗り越えたこと
taketakekaho
0
340
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
USB PDを使ってスマホを労わりたい
raspython3
0
180
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
160
Post AI時代のリファクタリング実践記 / Refactoring in the post AI era
kaminashi
1
250
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
280
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Color Theory Basics | Prateek | Gurzu
gurzu
1
490
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
520
The Curious Case for Waylosing
cassininazir
1
570
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