SlideShare a Scribd company logo
1 of 25
Download to read offline
Mark Meyer
Software Engineer at Sharethrough

mmeyer@sharethrough.com
ES6 For Fun & Profit
ES6: FOR FUN & PROFIT
What is ECMAScript
6?
Also known as ECMAScript2015
Latest standard of ECMAScript, ratified in June 2015. It’s the
first update since ECMAScript 5 in 2009. The fifth ratified
version of the spec. (ECMAScript 4 was abandoned due to
being too ambitious)
$
ES6: FOR FUN & PROFIT
What does the spec
cover?
Syntax - parsing rules, keywords, operators, etc.
Types - boolean, string, number, etc.
Prototypes and Inheritance
The Standard Library - JSON, Math, Array methods
$
ES6: FOR FUN & PROFIT
ES6 Will Change the
Way You Write JS
Code
Convenience Changes to Brain
Melting Concepts
Quoted From Jason Orendorff
ES6: FOR FUN & PROFIT
Influences From
Many Languages
CoffeeScript
Python
C++
Java
BASIC
E
Lisp
Smalltalk
CommonJS, AMD
Let’s get to the features!
ES6: FOR FUN & PROFIT
ES6: FOR FUN & PROFIT
Let & Const
Let is the new var
• Block Scoped
• Not hoisted
• Not added to global object
• Redeclaration is a syntax error
• Loops created a fresh binding of the variable
• Const variables can only be assigned once at declaration
ES6: FOR FUN & PROFIT
Symbols
The First Primitive Type since ES1
• Unique, Immutable values
• Symbol('foo') !== Symbol(‘foo')
• Can’t assign properties
• Used like Strings as names for object properties
• Exposed via reflection Object.getOwnPropertySymbols
ES6: FOR FUN & PROFIT
Arrows
CoffeeScript’s best feature goes
standard
• Share lexical this with surrounding code.
ES6: FOR FUN & PROFIT
Template Strings
String Interpolation Arrives
Adds support for Multiline Strings, Interpolation, and Tags to
prevent injection
ES6: FOR FUN & PROFIT
Classes
Syntactic Sugar on Prototypes
• Inheritance
• Constructors
• Super Calls
• Instance Methods
• Class (Static) Methods
• Getters & Setters
ES6: FOR FUN & PROFIT
Subclassing Built-In
Classes
Array, Date, and DOM Elements can
be subclassed
At vero eos et accusamus et iusto odio dignissimos ducimus
qui blanditiis praesentium voluptatum deleniti atque corrupti
quos dolores et quas molestias excepturi sint occaecati
cupiditate.
ES6: FOR FUN & PROFIT
Maps + WeakMaps
• Key, Value Stores
• Maps have no prototype, whereas objects have a
prototype, thus have default keys
• Keys of an object can only be Strings or Symbols
• Keys of a map can be any type
• Maps have size method to get number of key value pairs
• WeakMaps can only have object keys
• WeakMap keys are weakly held, so they will be GC’d if no
other reference exists
ES6: FOR FUN & PROFIT
Sets + WeakSets
Unique, Iterable Collection
• Collection of unique values
• Can be iterated in insertion order
• Sets have size method to get number of key value pairs
• WeakSets can contain objects only
• WeakSets create no strong references to the objects
ES6: FOR FUN & PROFIT
For … Of
For … In mistakes no more!
Iterate over objects, sets, and maps retrieving what you
probably meant all along
ES6: FOR FUN & PROFIT
Custom Iteration
Customize For…Of Iteration with custom iterator method
ES6: FOR FUN & PROFIT
Promises
No more libraries required
ES6: FOR FUN & PROFIT
Modules
• Export any top-level function, class, var, let, or const.
• Implicitly async model – no code executes until requested
modules are available and processed.
ES6: FOR FUN & PROFIT
And Now For Some Brain Melting
ES6: FOR FUN & PROFIT
Tails Calls
Stack Overflow No Mo’!
Recursive algorithms guaranteed to not grow the stack
unboundedly
ES6: FOR FUN & PROFIT
Destructuring
Binding via Pattern Matching
• Useful on arrays or objects
• Soft fail returning undefined like a normal property lookup
ES6: FOR FUN & PROFIT
Proxies
Wrap your objects for more power
• Intercept calls and redirect
• Log when accessing methods
• Profile how long calls take
• Very useful for mocks and stubs like Jasmine implements
ES6: FOR FUN & PROFIT
Generators
Yield to the power
• A subclass of iterators with a next and throw interface
• Yield returns a value while the generator object maintains
the current stack frame so that it can be called back into
• Not multithreaded
ES6: FOR FUN & PROFIT
A major upgrade that will change the way you write javascript
ES6 FTW!
ES6: FOR FUN & PROFIT
ES6 In Depth
https://hacks.mozilla.org/category/es6-in-depth/
ES6 Features
https://github.com/lukehoban/es6features#unicode
New Old Stock
http://nos.twnsnd.co/

More Related Content

Similar to ES6: Learn New JavaScript Features

Making ES6 available to all with ChakraCore and Typescript
Making ES6 available to all with ChakraCore and TypescriptMaking ES6 available to all with ChakraCore and Typescript
Making ES6 available to all with ChakraCore and TypescriptChristian Heilmann
 
Upgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcutUpgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcutChristian Heilmann
 
The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015Christian Heilmann
 
Building a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with CassandraBuilding a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with Cassandraaaronmorton
 
ECMAScript 6 Overview & Comparision
ECMAScript 6 Overview & ComparisionECMAScript 6 Overview & Comparision
ECMAScript 6 Overview & ComparisionTalal Suhail
 
ECMAScript: past, present and future
ECMAScript: past, present and futureECMAScript: past, present and future
ECMAScript: past, present and futureKseniya Redunova
 
Hunting for anglerfish in datalakes
Hunting for anglerfish in datalakesHunting for anglerfish in datalakes
Hunting for anglerfish in datalakesDominic Egger
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at TwitterAlex Payne
 
Data Engineering with Solr and Spark
Data Engineering with Solr and SparkData Engineering with Solr and Spark
Data Engineering with Solr and SparkLucidworks
 
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012Blend Interactive
 
Ladies Be Architects - Apex Basics
Ladies Be Architects - Apex BasicsLadies Be Architects - Apex Basics
Ladies Be Architects - Apex Basicsgemziebeth
 
F# in social gaming
F# in social gamingF# in social gaming
F# in social gamingYan Cui
 
Optimize perl5 code for perfomance freaks
Optimize perl5 code for perfomance freaksOptimize perl5 code for perfomance freaks
Optimize perl5 code for perfomance freakskarupanerura
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleNoam Kfir
 
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuireEmbracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuireDatabricks
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
 
Vulnerability, exploit to metasploit
Vulnerability, exploit to metasploitVulnerability, exploit to metasploit
Vulnerability, exploit to metasploitTiago Henriques
 

Similar to ES6: Learn New JavaScript Features (20)

Making ES6 available to all with ChakraCore and Typescript
Making ES6 available to all with ChakraCore and TypescriptMaking ES6 available to all with ChakraCore and Typescript
Making ES6 available to all with ChakraCore and Typescript
 
Upgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcutUpgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcut
 
Scala-Ls1
Scala-Ls1Scala-Ls1
Scala-Ls1
 
The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015
 
Building a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with CassandraBuilding a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with Cassandra
 
ECMAScript 6 Overview & Comparision
ECMAScript 6 Overview & ComparisionECMAScript 6 Overview & Comparision
ECMAScript 6 Overview & Comparision
 
ECMAScript: past, present and future
ECMAScript: past, present and futureECMAScript: past, present and future
ECMAScript: past, present and future
 
Hunting for anglerfish in datalakes
Hunting for anglerfish in datalakesHunting for anglerfish in datalakes
Hunting for anglerfish in datalakes
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 
Data Engineering with Solr and Spark
Data Engineering with Solr and SparkData Engineering with Solr and Spark
Data Engineering with Solr and Spark
 
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
 
Short and fast introduction to Scala
Short and fast introduction to ScalaShort and fast introduction to Scala
Short and fast introduction to Scala
 
Ladies Be Architects - Apex Basics
Ladies Be Architects - Apex BasicsLadies Be Architects - Apex Basics
Ladies Be Architects - Apex Basics
 
F# in social gaming
F# in social gamingF# in social gaming
F# in social gaming
 
Optimize perl5 code for perfomance freaks
Optimize perl5 code for perfomance freaksOptimize perl5 code for perfomance freaks
Optimize perl5 code for perfomance freaks
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black Hole
 
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuireEmbracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
 
Character sets
Character setsCharacter sets
Character sets
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Vulnerability, exploit to metasploit
Vulnerability, exploit to metasploitVulnerability, exploit to metasploit
Vulnerability, exploit to metasploit
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 

ES6: Learn New JavaScript Features

  • 1. Mark Meyer Software Engineer at Sharethrough
 mmeyer@sharethrough.com ES6 For Fun & Profit
  • 2. ES6: FOR FUN & PROFIT What is ECMAScript 6? Also known as ECMAScript2015 Latest standard of ECMAScript, ratified in June 2015. It’s the first update since ECMAScript 5 in 2009. The fifth ratified version of the spec. (ECMAScript 4 was abandoned due to being too ambitious) $
  • 3. ES6: FOR FUN & PROFIT What does the spec cover? Syntax - parsing rules, keywords, operators, etc. Types - boolean, string, number, etc. Prototypes and Inheritance The Standard Library - JSON, Math, Array methods $
  • 4. ES6: FOR FUN & PROFIT ES6 Will Change the Way You Write JS Code Convenience Changes to Brain Melting Concepts Quoted From Jason Orendorff
  • 5. ES6: FOR FUN & PROFIT Influences From Many Languages CoffeeScript Python C++ Java BASIC E Lisp Smalltalk CommonJS, AMD
  • 6. Let’s get to the features! ES6: FOR FUN & PROFIT
  • 7. ES6: FOR FUN & PROFIT Let & Const Let is the new var • Block Scoped • Not hoisted • Not added to global object • Redeclaration is a syntax error • Loops created a fresh binding of the variable • Const variables can only be assigned once at declaration
  • 8. ES6: FOR FUN & PROFIT Symbols The First Primitive Type since ES1 • Unique, Immutable values • Symbol('foo') !== Symbol(‘foo') • Can’t assign properties • Used like Strings as names for object properties • Exposed via reflection Object.getOwnPropertySymbols
  • 9. ES6: FOR FUN & PROFIT Arrows CoffeeScript’s best feature goes standard • Share lexical this with surrounding code.
  • 10. ES6: FOR FUN & PROFIT Template Strings String Interpolation Arrives Adds support for Multiline Strings, Interpolation, and Tags to prevent injection
  • 11. ES6: FOR FUN & PROFIT Classes Syntactic Sugar on Prototypes • Inheritance • Constructors • Super Calls • Instance Methods • Class (Static) Methods • Getters & Setters
  • 12. ES6: FOR FUN & PROFIT Subclassing Built-In Classes Array, Date, and DOM Elements can be subclassed At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate.
  • 13. ES6: FOR FUN & PROFIT Maps + WeakMaps • Key, Value Stores • Maps have no prototype, whereas objects have a prototype, thus have default keys • Keys of an object can only be Strings or Symbols • Keys of a map can be any type • Maps have size method to get number of key value pairs • WeakMaps can only have object keys • WeakMap keys are weakly held, so they will be GC’d if no other reference exists
  • 14. ES6: FOR FUN & PROFIT Sets + WeakSets Unique, Iterable Collection • Collection of unique values • Can be iterated in insertion order • Sets have size method to get number of key value pairs • WeakSets can contain objects only • WeakSets create no strong references to the objects
  • 15. ES6: FOR FUN & PROFIT For … Of For … In mistakes no more! Iterate over objects, sets, and maps retrieving what you probably meant all along
  • 16. ES6: FOR FUN & PROFIT Custom Iteration Customize For…Of Iteration with custom iterator method
  • 17. ES6: FOR FUN & PROFIT Promises No more libraries required
  • 18. ES6: FOR FUN & PROFIT Modules • Export any top-level function, class, var, let, or const. • Implicitly async model – no code executes until requested modules are available and processed.
  • 19. ES6: FOR FUN & PROFIT And Now For Some Brain Melting
  • 20. ES6: FOR FUN & PROFIT Tails Calls Stack Overflow No Mo’! Recursive algorithms guaranteed to not grow the stack unboundedly
  • 21. ES6: FOR FUN & PROFIT Destructuring Binding via Pattern Matching • Useful on arrays or objects • Soft fail returning undefined like a normal property lookup
  • 22. ES6: FOR FUN & PROFIT Proxies Wrap your objects for more power • Intercept calls and redirect • Log when accessing methods • Profile how long calls take • Very useful for mocks and stubs like Jasmine implements
  • 23. ES6: FOR FUN & PROFIT Generators Yield to the power • A subclass of iterators with a next and throw interface • Yield returns a value while the generator object maintains the current stack frame so that it can be called back into • Not multithreaded
  • 24. ES6: FOR FUN & PROFIT A major upgrade that will change the way you write javascript ES6 FTW!
  • 25. ES6: FOR FUN & PROFIT ES6 In Depth https://hacks.mozilla.org/category/es6-in-depth/ ES6 Features https://github.com/lukehoban/es6features#unicode New Old Stock http://nos.twnsnd.co/