intro to es6 / es2015

29
INTRO TO ES6/2015 MEAN STACK NYC | INTRO TO ES6/2015 Jamal O’Garro Software Engineer + Instructor

Upload: jamal-sinclair-ogarro

Post on 21-Mar-2017

391 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Intro to ES6 / ES2015

INTRO TO ES6/2015

MEAN STACK NYC | INTRO TO ES6/2015

Jamal O’Garro Software Engineer + Instructor

Page 2: Intro to ES6 / ES2015

WHAT’S BEING COVERED TODAY

• Let and Const

• Block Scoping

• Template Strings

• Iterators

• Fat Arrow Syntax

• Class Syntax

• Promises

• Generators

MEAN STACK NYC | INTRO TO ES6/2015

Page 3: Intro to ES6 / ES2015

BRIEF HISTORY OF JAVASCRIPT

• Created by Netscape as a browser scripting language

• Node.js allows JS to be run on the server

• ES6 standard is announced

MEAN STACK NYC | INTRO TO ES6/2015

Page 4: Intro to ES6 / ES2015

WHAT IS ECMASCRIPT?

• Specification that JavaScript is developed against

MEAN STACK NYC | INTRO TO ES6/2015

Page 5: Intro to ES6 / ES2015

WHAT IS ES6?

• Most recent version of the ECMAScript specification

• Introduces powerful new features and new syntax

• Is available for use now in most modern browsers

MEAN STACK NYC | INTRO TO ES6/2015

Page 6: Intro to ES6 / ES2015

WHY USE ES6?

• Allows us to write “safer” JavaScript

• Get to use a “nicer” syntax

• It’s the future and the future is now!

MEAN STACK NYC | INTRO TO ES6/2015

Page 7: Intro to ES6 / ES2015

NEW LANGUAGE FEATURES

MEAN STACK NYC | INTRO TO ES6/2015

Page 8: Intro to ES6 / ES2015

LET + CONSTMEAN STACK NYC | INTRO TO ES6/2015

Page 9: Intro to ES6 / ES2015

LET + CONST RECAP

• “let” and “const” allow us to have block scoping

• “const” allows us to create immutable data

• We also have the ability to create blocks on-the-fly

MEAN STACK NYC | INTRO TO ES6/2015

Page 10: Intro to ES6 / ES2015

TEMPLATE STRINGSMEAN STACK NYC | INTRO TO ES6/2015

Page 11: Intro to ES6 / ES2015

TEMPLATE STRINGS RECAP

• Allow us to perform string interpolation in JavaScript

• Prevents us from having to concat strings

• Get a performance boost over string concatenation

MEAN STACK NYC | INTRO TO ES6/2015

Page 12: Intro to ES6 / ES2015

FAT ARROW FUNCTIONSMEAN STACK NYC | INTRO TO ES6/2015

Page 13: Intro to ES6 / ES2015

FAT ARROW RECAP

• Provide a new syntax to represent lambda functions

• Give us a lexical “this” in functions that aren’t direct properties of objects

MEAN STACK NYC | INTRO TO ES6/2015

Page 14: Intro to ES6 / ES2015

NEW OBJECT SYNTAXMEAN STACK NYC | INTRO TO ES6/2015

Page 15: Intro to ES6 / ES2015

NEW OBJECT SYNTAX RECAP

• Syntactic sugar for creating properties of objects

MEAN STACK NYC | INTRO TO ES6/2015

Page 16: Intro to ES6 / ES2015

CLASSESMEAN STACK NYC | INTRO TO ES6/2015

Page 17: Intro to ES6 / ES2015

CLASSES RECAP

• Syntax “sugar” for constructor functions

• Easy inheritance

• Super keyword

• Clean way to create static methods

MEAN STACK NYC | INTRO TO ES6/2015

Page 18: Intro to ES6 / ES2015

NEW DATA TYPES

MEAN STACK NYC | INTRO TO ES6/2015

Page 19: Intro to ES6 / ES2015

ITERATORSMEAN STACK NYC | INTRO TO ES6/2015

Page 20: Intro to ES6 / ES2015

ITERATOR VS. ITERABLE

• Iterator - allows us to produce a sequence of values (Generators, etc.)

• Iterable - Means an object can be iterated (String, Array, Map, Set, etc.)

MEAN STACK NYC | INTRO TO ES6/2015

Page 21: Intro to ES6 / ES2015

PROMISESMEAN STACK NYC | INTRO TO ES6/2015

Page 22: Intro to ES6 / ES2015

PROMISE RECAP

• Allow us to work with Promises natively in the language

MEAN STACK NYC | INTRO TO ES6/2015

Page 23: Intro to ES6 / ES2015

GENERATORSMEAN STACK NYC | INTRO TO ES6/2015

Page 24: Intro to ES6 / ES2015

WHY ARE GENERATORS USEFUL?

• Allow us to pause a function

• Control of the function’s execution externally

• Can pass data to the paused execution

• Can be used for asynchronous coding that “looks” synchronous

MEAN STACK NYC | INTRO TO ES6/2015

Page 25: Intro to ES6 / ES2015

SUMMARY

MEAN STACK NYC | INTRO TO ES6/2015

Page 26: Intro to ES6 / ES2015

WHAT DID WE NOT COVER TODAY?

• Symbols

• Maps

• Weak Maps

• Sets

• Weak Sets

• Some features that are not ready (at least not in V8 and Node)

MEAN STACK NYC | INTRO TO ES6/2015

Page 27: Intro to ES6 / ES2015

WHAT’S CURRENTLY NOT AVAILABLE?

• Destructured assignment

• Parameter Default Values

• Rest

• Spread

• Modules

• Proxies

• Typed Array

MEAN STACK NYC | INTRO TO ES6/2015

Page 28: Intro to ES6 / ES2015

HOW TO USE WHAT’S NOT READY?

• Polyfills

• Transpilers

• Babel.js

• Tracuer

• TypeScript

MEAN STACK NYC | INTRO TO ES6/2015

Page 29: Intro to ES6 / ES2015

THANK YOU!!!

Jamal O’Garro Software Engineer + Instructor

MEAN STACK NYC | INTRO TO ES6/2015