Skip to content

Instantly share code, notes, and snippets.

@challey17
Forked from ricklopez/js-in-depth-es6.md
Created March 9, 2020 02:46
Show Gist options
  • Save challey17/0583861ea422b0a7c0c857a10b6104ac to your computer and use it in GitHub Desktop.
Save challey17/0583861ea422b0a7c0c857a10b6104ac to your computer and use it in GitHub Desktop.
  1. What is ES6

  2. Let & Const

    • uses block scoping
    • const cannot be reassigned
    • not hoisted
  3. Arrow Functions

    • uses block scoping
    • implied this value assignment
    • no prototype
    • The real purpose of arrow functions is to handle the THIS keyword withing nested / callback functions
    • You cannot bind new objects to arrow functions (call, apply, bind)
    • not hoisted
  4. Default Function Parameters

    • we can specify default values for parameters
    • must go last in param list
    • each param can reference the param before it
  5. Rest and Spread

    • Rest groups passed args into array
    • Rest default is array
    • Rest Arg lenth will still show total args values passed
    • Spread is the oposite of Rest
    • Spread take an collection of values and spreads them out as individual arg values
  6. Object Literal Extension

    • propety and method shorthand (left hand right hand code)
    • implied rule use for setting this value in methods. Like arrow functions
  7. Template Literals

    • better string building with variables
  8. Destructoring

  9. Classes

    • Classes still use constructors
    • Classes still use prototype
    • Just a wrapper over es5 protypal inheritance
    • not hoisted
    • build protype chain using extends keyword
    • super is use to call parent class constructor
    • can set properties in constructor
    • can set instance methods in body
    • can set static members in body (accessed directly from class not instance)
  10. Where to go from here

  11. Repl Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment