Cheat Sheets
ES6 Features · Study material
ES6 Features Cheat Sheet
| Code | Meaning |
|---|---|
class A { #x = 0; static n = 0; constructor() {} get v() {} } | private field, static, accessor |
class B extends A { constructor() { super(); } } | inheritance |
super.method() | call the parent's version |
#x in obj | private brand check (inside the class) |
new Map([[k, v]]) · map.get/set/has/delete/size | Map |
[...new Set(arr)] | remove duplicates |
new WeakMap() | object keys, not iterable |
Symbol("id") · Symbol.iterator | unique key · iteration hook |
function* g() { yield 1; } | generator |
yield* other | delegate to another iterable |
export default X · export { a, b } | exports |
import X, { a as b } from "./m.js" | imports |
await import("./m.js") | dynamic import |