JS Knowledge - foxymoron/test GitHub Wiki

Basic stuff

  1. Hoisting
  2. Closures
  3. Prototypes
  4. Prototypal inheritance
  5. Event Loop
  6. Double bang !!
  7. Short circuiting
  8. Currying
  9. Promises
  10. IIFE
  11. Function declaration vs Function expression
  12. Named vs anonymous Functions
  13. Higher Order Functions
  14. Lexical scoping
  15. call, apply, bind

ES6 Features (Must Know)

  1. Object destructuring
  2. Rest parameters
  3. Spread operator
  4. Arrow functions
  5. class / super / extends
  6. import / export / default / *
  7. async / await

Upcoming ES2020 Features (Experimental)

Private fields in classes.

class Counter {
  #x = 0;
  increment() {
    this.#x++;
  }
  decrement() {
    this.#x--;
  }
  getNum(){
    return this.#x;
  }
}
const c = new Counter();
c.increment(); // 1
c.decrement(); // 0
c.getNum(); // 0
c.#x; // Uncaught SyntaxError: Private field '#x'

Optional Chaining Operator

// old school
const val = obj.prop1 &&
  obj.prop1.prop2 &&
  obj.prop1.prop2 &&
  obj.prop1.prop2.prop3 &&
  obj.prop1.prop2.prop3.prop4 &&
  obj.prop1.prop2.prop3.prop4.prop5;

// new proposed way
const val = obj?.prop1?.prop2?.prop3?.prop4?.prop5

Nullish Coalescing Operator

// old school
const y = x || 500; // fails when x is falsy like 0, false etc...

// new proposed way
const y = x ?? 500; // activates only for null/undefined

References: