Tổng kết, cheat sheet ES2015–ES2026 và lộ trình tiếp theo
Chúc mừng bạn đã hoàn thành khóa học! 🎉
Viết JavaScript hiện đại — checklist
-
constmặc định,letkhi cần gán lại, khôngvar. -
===,??,?.thay cho==,||(khi có0/""), chuỗi&&dài. - Phương thức bất biến:
toSorted,toReversed,with, spread,structuredClone. -
Object.groupBy/Map.groupBy,Map/Set(kèm Set methods) thay vì tự viết. -
classvới#private, composition hơn kế thừa sâu. - Iterator helpers cho dữ liệu lớn/vô hạn.
-
async/await+Promise.all/allSettled; giới hạn số tác vụ đồng thời; luôn xử lý lỗi. -
fetchkiểm trares.ok;AbortSignal.timeoutcho timeout. - ES Modules,
node:prefix, import JSON vớiwith { type: "json" }. - Lỗi là
Errorthật, cócause; kiểm tra bằngError.isErrorkhi cần. -
usingcho tài nguyên cần dọn dẹp; Temporal cho ngày giờ (khi môi trường hỗ trợ). -
textContentthayinnerHTMLvới dữ liệu người dùng;RegExp.escapevới input trong RegExp.
Cheat sheet theo phiên bản
| Phiên bản | Tính năng bạn sẽ dùng hằng ngày |
|---|---|
| ES2015 | let/const, arrow, class, module, Promise, template literal, destructuring, Map/Set, for...of, generator, Symbol |
| ES2016–2019 | **, includes, async/await, Object.entries/fromEntries, rest/spread object, flat/flatMap, for await |
| ES2020 | ?., ??, BigInt, Promise.allSettled, globalThis, import() |
| ES2021 | replaceAll, Promise.any, ??= ||= &&=, 1_000, WeakRef |
| ES2022 | class field, #private, static block, top-level await, .at(), Object.hasOwn, Error cause |
| ES2023 | toSorted, toReversed, toSpliced, with, findLast |
| ES2024 | Object.groupBy, Map.groupBy, Promise.withResolvers, cờ RegExp v, resizable ArrayBuffer, isWellFormed |
| ES2025 | Iterator helpers, Set methods, Promise.try, RegExp.escape, RegExp modifiers, duplicate named groups, import attributes & JSON modules, Float16Array |
| ES2026 | Array.fromAsync, Error.isError, Math.sumPrecise, Uint8Array base64/hex, Iterator.concat, JSON.parse source text & JSON.rawJSON, Map/WeakMap getOrInsert |
| ES2027 (Stage 4) | Temporal, using/await using & DisposableStack, Iterator.zip |
Theo dõi JavaScript tiếp theo
- TC39 proposals trên GitHub (
tc39/proposals) — xem tính năng nào đang ở stage nào. - MDN Web Docs — tài liệu và bảng tương thích đáng tin cậy nhất.
- Ghi chú phát hành của Node.js, V8, Chrome, Firefox, Safari.
Lộ trình tiếp theo
- TypeScript — bước tiếp theo gần như bắt buộc cho dự án thật.
- Một framework frontend — React (phổ biến nhất), Vue, Svelte hoặc Solid.
- Backend với Node.js — REST/GraphQL API, database (PostgreSQL), xác thực.
- Testing — unit test (
node:test, Vitest), end-to-end (Playwright). - Công cụ — Git, ESLint, Prettier, Vite, CI/CD.
TIP
Cách học nhanh nhất là làm dự án: một trang todo có lưu localStorage, một ứng dụng thời tiết gọi API, một CLI bằng Node.js, rồi một ứng dụng full-stack nhỏ. Mỗi dự án sẽ buộc bạn dùng lại những gì đã học trong khóa này.
Chúc bạn code vui! 🚀
Comments