← Study Notes Frontend


Frontend

JavaScript

The single native language of the browser — an event-driven, single-threaded runtime with an async event loop, closures and prototypes — now running everywhere via Node. It makes pages interactive and powers entire stacks. Its dynamic typing and historical quirks (this-binding, coercion) are exactly why teams reach for TypeScript and strict linters.


Purpose

JavaScript is the browser's single native language — an event-driven, single-threaded runtime whose event loop juggles user input, timers and network I/O without blocking. Via Node.js the same language now runs servers, build tools and CLIs, making it the most widely deployed language in the world.

When to Use It

In the browser it powers every interaction beyond a static page; on the server it suits I/O-heavy workloads — APIs, gateways, real-time apps — where the non-blocking model shines. One language across the stack also lets teams share types, validation and tooling end to end.

Trade-offs

The single thread means CPU-heavy work freezes everything — offload it to workers. Dynamic typing and historical quirks (implicit coercion, this binding) let whole classes of bugs reach runtime, which is exactly why teams layer TypeScript and strict linting on top.

Implementation

Master the async model: promises and async/await, and what actually happens in the event loop's task and microtask queues. Understand closures (functions capture their scope) and modules; prefer const, strict equality and small pure functions. Modern ES features — destructuring, spread, optional chaining — remove most of the old pain.