Part 06 · JS/TS · 6.1

ECMAScript semantics, host runtime và static types

JavaScript language không đồng nhất với browser hay Node.js; TypeScript thêm compile-time model nhưng không tự validate dữ liệu runtime.

Cách học: với mỗi chủ đề, xác định spec guarantee, host-specific behavior, observable evidence và failure khi code chạy production.
01 · Runtime

Execution model

Agents, jobs, realms, execution contexts và host runtime.

02 · Values

Values, coercion & equality

Primitive/object, ToPrimitive, equality, numbers và serialization.

03 · Scope

Bindings, closures & modules

Lexical environment, live bindings, ESM/CJS và cycles.

04 · Objects

Descriptors, prototypes & classes

Property lookup, mutation, inheritance và private state.

05 · Functions

Calls, this, iterators & memory

Call-site binding, generators, iterables, closures và retention.

06 · Async

Tasks, microtasks, Promise & abort

Event loop, ordering, cancellation, races và backpressure.

07 · Browser

DOM, events, fetch & security

Origin, storage, permissions, CSP và browser lifecycle.

08 · TypeScript

Structural types & narrowing

Unknown/any, discriminated unions, control flow và runtime boundary.

09 · Advanced TS

Generics, modules & tsconfig

Generic constraints, variance, declaration files và project references.

10 · Production

Performance, testing & tooling

Profiling, bundling, source maps, test isolation và supply chain.