JavaScript
Overview
JavaScript is the runtime language behind the frontend and much of the tooling around it.
Why It Matters
Strong JavaScript fundamentals make React, Next.js, and debugging work much easier.
Core Concepts
- Closures capture scope.
- Promises model async work.
- Objects, arrays, and functions are the everyday data tools.
Mental Models
Reason about values, references, and timing. Many frontend bugs are just those three concepts colliding.
Best Practices
- Keep async flow explicit.
- Prefer clear data transformations.
- Be careful with mutation and shared references.
Common Mistakes
- Ignoring promise rejection paths.
- Mutating state in place.
- Overusing clever one-liners.
Trade-offs
Functional style can be easier to reason about, but too much abstraction can obscure simple data flow.
Decision Framework
| Need | Prefer |
|---|---|
| Clear async sequence | async / await |
| Parallel work | Promise.all |
| Data transformation | map, filter, reduce |
Examples
const names = users.filter((u) => u.active).map((u) => u.name);
Checklists
- Are async errors handled?
- Is mutation intentional?
- Can the code be read top to bottom?
Senior Engineer Notes
Senior engineers use JavaScript well enough that the code disappears and the intent remains.