Arrow functions
Destructuring
Spread & rest
Template literals
Optional chaining & nullish coalescing
Modules
Other key features
| Feature | Example |
|---|---|
let/const | Block-scoped variable declarations |
| Symbol | Unique primitive values |
| Map/Set | Key-value and unique-value collections |
| WeakMap/WeakSet | Garbage-collectible references |
| Proxy/Reflect | Intercept object operations |
| Generator functions | function*, yield |
for...of | Iterate over iterables |
Promise | Built-in async abstraction |
class | Syntactic sugar for prototypal inheritance |
Common interview questions
What is the difference between spread and rest?
What is the difference between spread and rest?
They use the same syntax (
...) but in different contexts:- Spread — used in call/literal position; expands an iterable into individual elements.
- Rest — used in parameter/destructuring position; collects multiple elements into an array.
When would you use Map over a plain object?
When would you use Map over a plain object?
- Keys can be any type (not just strings/Symbols).
- Maintains insertion order reliably.
- Has a built-in
sizeproperty. - Better performance for frequent add/delete operations.
- No inherited prototype keys that could conflict.
What is the difference between ?? and ||?
What is the difference between ?? and ||?
|| returns the right-hand side when the left is falsy (0, "", false, null, undefined). ?? (nullish coalescing) only returns the right-hand side when the left is null or undefined, so 0 and "" are treated as valid values.