Slide 1

Slide 1 text

kyle simpson http://getify.me @getify ES6: features by testing

Slide 2

Slide 2 text

ES6/2015

Slide 3

Slide 3 text

Block-Scoped Declarations Spread / Rest Default Parameter Values Destructuring Object Literal Extensions Template Literals Arrow Functions `for..of` Loops Regular Expression Extensions Number Literal Extensions Unicode Symbols Iterators Generators Modules Classes

Slide 4

Slide 4 text

Promises Generators + Promises Typed Arrays Maps WeakMaps Sets WeakSets `Array` `Object` `Math` `Number` `String` Function Names Meta Properties Well Known Symbols Proxies `Reflect` API Tail Call Optimization (TCO)

Slide 5

Slide 5 text

the hype

Slide 6

Slide 6 text

arrow functions

Slide 7

Slide 7 text

arrow functions

Slide 8

Slide 8 text

arrow functions • will it ever need this/super? • will it ever need a lexical name? • will it ever need more than one statement? • will its return have side effects? • are all the syntax variances really readable/obvious? caveats

Slide 9

Slide 9 text

arrow functions

Slide 10

Slide 10 text

the substance

Slide 11

Slide 11 text

array spread :(

Slide 12

Slide 12 text

array spread \o/

Slide 13

Slide 13 text

array spread :(

Slide 14

Slide 14 text

array spread \o/

Slide 15

Slide 15 text

array gather (aka "rest") :(

Slide 16

Slide 16 text

array gather (aka "rest") \o/

Slide 17

Slide 17 text

parameter defaults :(

Slide 18

Slide 18 text

parameter defaults \o/

Slide 19

Slide 19 text

destructuring :(

Slide 20

Slide 20 text

destructuring & concise properties :/

Slide 21

Slide 21 text

destructuring & concise properties whitespace / indentation ftw \o/

Slide 22

Slide 22 text

destructuring (renaming/defaults) :(

Slide 23

Slide 23 text

destructuring (renaming/defaults) \o/

Slide 24

Slide 24 text

destructuring & restructuring

Slide 25

Slide 25 text

destructuring & restructuring :(

Slide 26

Slide 26 text

\o/ destructuring & restructuring

Slide 27

Slide 27 text

async: promises & generators :(

Slide 28

Slide 28 text

async: promises & generators :/

Slide 29

Slide 29 text

async: promises & generators github.com/getify/asynquence \o/

Slide 30

Slide 30 text

\o/ async: promises & generators

Slide 31

Slide 31 text

\o/ async: promises & generators

Slide 32

Slide 32 text

\o/ async: promises & generators

Slide 33

Slide 33 text

async: promises & generators async functions (es7'ish) \o/

Slide 34

Slide 34 text

:/ async: promises & generators

Slide 35

Slide 35 text

\o/ async: promises & generators

Slide 36

Slide 36 text

iterators :(

Slide 37

Slide 37 text

iterators \o/

Slide 38

Slide 38 text

iterators :/

Slide 39

Slide 39 text

\o/ iterators

Slide 40

Slide 40 text

excited yet!?

Slide 41

Slide 41 text

ES6 browsers are ubiquitous, right? not exactly. :(

Slide 42

Slide 42 text

transpiling ftw \o/

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

polyfills ftw \o/

Slide 45

Slide 45 text

github.com/paulmillr/es6-shim

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

what features do you need?

Slide 48

Slide 48 text

96% of all JS programs need less than 37% of ES6 *totally made up * *

Slide 49

Slide 49 text

Microsoft Edge 0.11.10074.0 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

transpiling & polyfilling: can't • several well-known symbols • subclassing natives • __proto__ • tail call optimization (rewriting to tail calls can) https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/ suggestions/6850816-es6-tail-call-optimization • others... caveats

Slide 52

Slide 52 text

transpiling ftl polyfills ftl :(

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

feature testing ftw \o/

Slide 55

Slide 55 text

feature testing: APIs

Slide 56

Slide 56 text

feature testing: syntax

Slide 57

Slide 57 text

feature testing: syntax

Slide 58

Slide 58 text

https://FeatureTests.io

Slide 59

Slide 59 text

https://FeatureTests.io

Slide 60

Slide 60 text

demo

Slide 61

Slide 61 text

don't shy away from ES6+, start using these features now

Slide 62

Slide 62 text

ongoing gap

Slide 63

Slide 63 text

don't serve code on the trailing edge of that gap

Slide 64

Slide 64 text

transpiling & polyfilling => developing for the current & future

Slide 65

Slide 65 text

serve the right code for the right browser

Slide 66

Slide 66 text

blog.getify.com/smarter-transpilation-strategy

Slide 67

Slide 67 text

kyle simpson http://getify.me @getify thanks! https://github.com/getify/You-Dont-Know-JS/blob/master/es6%20& %20beyond/README.md#you-dont-know-js-es6--beyond