Learning Javascript Flashcards
(46 cards)
Primitive types
Kiểu dữ liệu nguyên thủy: string, number, boolean, null, undefined, symbol, bigint
Boolean: Truthy/Falsy
Giá trị nào được ép thành true/false khi convert sang boolean
Hoisting
Variable/function declarations are moved to the top
Đưa khai báo biến/hàm lên đầu phạm vi
Scope
Where a variable is accessible
Phạm vi biến có thể được truy cập
Closure
Function remembers variables from its lexical scope
Hàm ghi nhớ biến của phạm vi cha
Lexical Scope
Scope determined by code location
Phạm vi xác định theo vị trí mã nguồn
IIFE
Function that runs immediately after declaration
Hàm tự chạy ngay sau khi định nghĩa
this
Context depending on how function is called
Ngữ cảnh – phụ thuộc cách gọi hàm
call / apply / bind
Set this manually when calling a function
Gán this thủ công khi gọi hàm
Prototype
Object inheritance chain
Chuỗi kế thừa đối tượng
Event Loop
JS concurrency model for async tasks
Cơ chế xử lý bất đồng bộ
Promise
Handle asynchronous values
Giá trị bất đồng bộ trong tương lai
async / await
Syntactic sugar for working with Promises
Cú pháp ngắn gọn xử lý Promise
try / catch / finally
Error handling structure
Cấu trúc xử lý lỗi
typeof / instanceof
Type checking operators
Toán tử kiểm tra kiểu
Destructuring
Extract values from object/array
Giải nén biến từ object/array
Spread / Rest
Copy or group values with …
Toán tử trải rộng hoặc gom nhóm
Template literals
String interpolation with backticks
Chuỗi nội suy dùng backtick ``
Arrow function
Shorter function syntax without this binding
Hàm ngắn gọn, không có this riêng
Map / Set
New data structures for key-value or unique values
Cấu trúc dữ liệu mới cho key-value hoặc giá trị không trùng
WeakMap / WeakSet
Like Map/Set but with weak references
Giống Map/Set nhưng tránh memory leak
Array methods
Useful array operations: map, filter, reduce, etc.
Các phương thức xử lý mảng
Pure Function
Function with no side effects
Hàm thuần – không thay đổi bên ngoài
Immutability
Avoid mutating original data
Tính bất biến – không thay đổi dữ liệu gốc