ES6J A V A S C R I P T N E W W A Y
I S M A I L H A M Z A H .
JS
THE MENU:
• LET is the newVAR
• Arrow Function
• Function Parameter DefaultValue
• CONST declaration
• Shorthand Properties
• Object Enhancements
• Spread Operator
• Template Literal
• Destructuring
• Promises
LET IS THE NEW VAR
VAR
• Function scope (or global)
• Variable Hoisting
LET
• Block scope
• No more Hoisting
ARROW FUNCTION
Old Way ES6 New Way
FUNCTION PARAMETER DEFAULT VALUE
Old Way
• Test the parameter to ‘undefined’
at the body function, and then
assign value if ‘undefined’.
ES6 New Way
• Simply put parameter default value
in the function head.
CONST DECLARATION
Old Way
• Using upper case to declare
variable which the value will
remain constant. But this actually
did not prevent the variable to re-
assign new value.
ES6 New Way
• CONST declaration to create
read-only reference to a value.
SHORTHAND PROPERTIES
Old Way ES6 New Way
• Easily construct object with
property that you already have.
(backward destructuring)
SPREAD OPERATOR
Old Way ES6 New Way
TEMPLATE LITERAL
Old Way ES6 New Way
• Using back-tick (` `) for string
template and interpolation.
DESTRUCTURING
Old Way ES6 New Way
• Unpack values from array, or
properties from object.
PROMISES
Old Way
• Callback hell
ES6 NewWay
• Promises object represents the
eventual completion (or failure) of
an asynchronous operation,and its
resulting value
THE END.
• Ismail Hamzah (ERP Consultant & Software Developer).
• go2ismail@gmail.com
• https://www.linkedin.com/in/go2ismail/

ES6 JavaScript New Way

  • 1.
    ES6J A VA S C R I P T N E W W A Y I S M A I L H A M Z A H . JS
  • 2.
    THE MENU: • LETis the newVAR • Arrow Function • Function Parameter DefaultValue • CONST declaration • Shorthand Properties • Object Enhancements • Spread Operator • Template Literal • Destructuring • Promises
  • 3.
    LET IS THENEW VAR VAR • Function scope (or global) • Variable Hoisting LET • Block scope • No more Hoisting
  • 4.
  • 5.
    FUNCTION PARAMETER DEFAULTVALUE Old Way • Test the parameter to ‘undefined’ at the body function, and then assign value if ‘undefined’. ES6 New Way • Simply put parameter default value in the function head.
  • 6.
    CONST DECLARATION Old Way •Using upper case to declare variable which the value will remain constant. But this actually did not prevent the variable to re- assign new value. ES6 New Way • CONST declaration to create read-only reference to a value.
  • 7.
    SHORTHAND PROPERTIES Old WayES6 New Way • Easily construct object with property that you already have. (backward destructuring)
  • 8.
  • 9.
    TEMPLATE LITERAL Old WayES6 New Way • Using back-tick (` `) for string template and interpolation.
  • 10.
    DESTRUCTURING Old Way ES6New Way • Unpack values from array, or properties from object.
  • 11.
    PROMISES Old Way • Callbackhell ES6 NewWay • Promises object represents the eventual completion (or failure) of an asynchronous operation,and its resulting value
  • 12.
    THE END. • IsmailHamzah (ERP Consultant & Software Developer). • go2ismail@gmail.com • https://www.linkedin.com/in/go2ismail/