Modern JavaScript Core
When to use this skill
- •Writing vanilla JavaScript logic.
- •Understanding modern syntax in PR reviews.
- •Avoiding legacy patterns (var, callbacks).
1. Essential Syntax
- •Variables:
constby default,letif reassignment is needed. Nevervar. - •Functions: Arrow functions
() => {}for callbacks and lexicalthis. - •Destructuring: Use generously (
const { id, name } = user). - •Template Literals: Use backticks for string interpolation.
2. Async Patterns
- •Async/Await: Prefer over
.then()chains. - •Top-level Await: Supported in modern modules.
- •Promise.allSettled: Better for unrelated concurrent tasks than
Promise.all(which fails fast).
3. Modules
- •ES Modules:
import/exportsyntax is standard. - •Named Exports: Prefer named exports (
export const foo) overexport defaultfor better refactoring support.
4. Modern Array Methods
- •Usage:
map,filter,reduce,find,some,every. - •Newer:
floated(toSorted),toSpliced(immutable alternatives).