The document discusses the ES6 (ECMAScript 2015) specification and challenges with adopting it. Some key points:
- ES6 provides many new features but poses issues as browsers have varying support levels
- Transpiling ES6 to ES5 allows use of new features but adds steps and browsers never get the native code
- Feature testing can be used but has limitations and complexity
- Options like libraries introduce dependencies rather than using the standard
- Widespread testing and use of ES6 is needed to improve support and performance in browsers
3. JAVASCRIPT ISโฆ
โข An incredibly versatile
language
โข Available web-โwide and across
many platforms
โข Toolset independent
โข Forgiving and inviting
4. YOU CAN USE
JAVASCRIPT
โข In browsers on the web
โข On the server
โข In applications
โข To access services
โข As a data format (๏ดพJSON)๏ดฟ
โข On hardware
โข โฆ your turn, surprise me :)๏ดฟ
15. WE BREAK THE WEB
FOR THE SAKE OF
DEVELOPER
CONVENIENCEโฆ
16. THE JAVASCRIPT
LEARNING PROCESS
HAS ALWAYS BEEN
INTERESTINGโฆ
โข Use view source to see what
others are doingโฆ
โข Copy and paste the bits that
look like they are responsible
for some things
โข Change some numbers around
โข Run into errors
โข Blame Internet Explorer
17. THIS, OF COURSE,
WAS WRONG AND
WE GOT MORE
PROFESSIONALโฆ
โข Search for a solution on
Stackoverflow
โข Copy and paste the bits that
look like they are responsible
for some things
โข Change some numbers around
โข Run into errors
โข Blame JavaScript for being
terrible and not a real language
โข For good measure, blame
Internet Explorer.
20. โข Arrow functions as a short-hand version of an
anonymous function.
โข Block-level scope using let instead of var makes
variables scoped to a block (if, for, while, etc.)
โข Classes to encapsulate and extend code.
โข Constants using the const keyword.
โข Default parameters for functions like foo(bar = 3, baz =
2)
โข Destructuring to assign values from arrays or objects
into variables.
โข Generators that create iterators using function* and
the yield keyword.
โข Map, a Dictionary type object that can be used to store
key/value pairs. and Set as a collection object to store
a list of data values.
โข Modules as a way of organizing and loading code.
โข Promises for async operations avoiding callback hell
โข Rest parameters instead of using arguments to access
functions arguments.
โข Template Strings to build up string values including
multi-line strings.
ES6 COMES WITH SO
MUCH GOODNESS,
TECHNICALLY IT HAS
TO BE FATTENINGโฆ
21. Library Builders
map, set & weakmap
__proto__
Proxies
Symbols
Sub7classable built7ins
Scalable Apps
let, const & block7
scoped bindings
Classes
Promises
Iterators
Generators
Typed arrays
Modules
Syntactic Sugar
Arrow functions
Enhanced object literals
Template strings
Destructuring
Rest, Spread, Default
String, Math, Number,
Object, RegExp APIs
ALL OF THESE PARTS HAVE DIFFERENT AUDIENCES
22. SUPPORT IS ENCOURAGING (๏ดพEDGE, FIREFOX, CHROME, SAFARI (๏ดพON 9)๏ดฟ)๏ดฟ
http://kangax.github.io/compat-table/es6/
25. THE SOLUTION: TRANSPILING INTO ES5โฆ
https://babeljs.io
โข Converts ES6 to older versions on the server or the client
โข In use by Facebook and many others
โข Used in editors and tool chains
26. โ Extra step between writing code
and running it in the browser.
โ We donโt run or debug the code
we write.
โ We hope the transpiler creates
efficient code
โ We create a lot of code
โ Browsers that support ES6 will
never get any.
THE PROBLEMS WITH
TRANSPILING:
28. โ It is an extra step that might be
costly
โ We can only do it client-โside
โ We can get false positives -โ
experimental features might be
implemented in a rudimentary
fashion
โ We have to keep your feature
tests up-โto-โdate and extend them
as needed -โ support for one
feature doesnโt mean support for
another.
THE PROBLEMS WITH
FEATURE TESTING:
29. YOU CAN USE AN
ABSTRACTION,
FRAMEWORK OR
LIBRARY THAT HAS
SIMILAR FEATURESโฆ
30. โ They makes us dependent on
that abstraction
โ We canโt control possible version
clashes in the abstraction layer
โ Maintainers need to know the
abstraction instead of the
standard of ES6
PROBLEMS WITH
ANY ABSTRACTION
31. THE ES6
CONUNDRUMโฆ
โข We canโt use it safely in the wild
โข We can use TypeScript or transpile it
โข We can feature test for it, but that can
get complex quickly
โข Browsers that support it, will not get
any ES6 that way (๏ดพbut can use it
internally)๏ดฟ
โข The performance is bad right now
(๏ดพwhich is a normal thing)๏ดฟ. To improve
this, we need ES6 to be used in the
wildโฆ
http://www.sitepoint.com/the-โes6-โconundrum/
34. BE ACTIVE!
If you use JavaScript in an
environment you control,
please use ES6 and feed
back your experiences to
the browser creators and
the standard bodies.
35. HELP ES6 BY
LOOKING AT ITS
UNIT TESTSโฆ
https://github.com/tc39/test262
http://test262.ecmascript.org/