JS Knowledge - foxymoron/test GitHub Wiki
Basic stuff
- Hoisting
- Closures
- Prototypes
- Prototypal inheritance
- Event Loop
- Double bang !!
- Short circuiting
- Currying
- Promises
- IIFE
- Function declaration vs Function expression
- Named vs anonymous Functions
- Higher Order Functions
- Lexical scoping
- call, apply, bind
ES6 Features (Must Know)
- Object destructuring
- Rest parameters
- Spread operator
- Arrow functions
- class / super / extends
- import / export / default / *
- 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: