Please enable JavaScript.
Coggle requires JavaScript to display documents.
JS-General - Coggle Diagram
JS-General
Other-side
classes in ES6
In ES6, Javascript classes are primarily syntactic sugar over JavaScript’s existing prototype-based inheritance
-
modules
refer to small units of independent, reusable code
-
scope
the accessibility of variables, functions, and objects in some particular part of your code during runtime.
strict mode
define
-
a new feature in ECMAScript 5 that allows you to place a program, or a function, in a “strict” operating context
-
-
Event
-
preventDefault
preventDefault() method cancels the event if it is cancelable,
-
-
event delegation
listening to events where you delegate a parent element as the listener for all of the events that happen inside it.
-
same-origin policy
-
An origin is defined as a combination of URI scheme, hostname, and port number.
prevents a malicious script on one page from obtaining access to sensitive data on another web page using Document Object Model(DOM).
-
-
-
-
TypeScript
notion
-
that adds optional types, classes, async/await, and many other features
-
-
-
-
Window
Theory
-
methods like alert(), confirm() and properties like document, location
-
-
-
-
-
Call, Apply, Bind
Call && Apply
-
Difference
call() truyền vào từng arg one-by-one, trong khi apply() truyền arg vào là 1 mảng
Bind
Bind tạo ra một function mới, với context this là object đã nhận, function mới này có thể gọi lại nhiều lần
với mỗi function mới được tạo ra từ (function gốc).bind sẽ không chấp nhận bất kì context nào cho this nữa, this trong function này sẽ là object được bind lần tiên.
difference between Call, Apply and Bind
-
-
bind
returns a new function, allowing you to pass any number of arguments
Value
undefined value
-
-
-
indicates that a variable has not been assigned a value, declared but not initialized at all
-
NaN
represents "Not-a-Number" value. i.e,
-
Document
-
-
methods like getElementById, getElementsByTagName, createElemen
Dom
Bubbling & Capturing
Bubbling
When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors.
Capturing
-
Giải quyết event bubbling không thể lắng nghe được, ví dụ như event focus của input.
-
General
-
use strict
-
To keep the old code working, most such modifications are off by default.
-
your code is all in classes and modules, you may omit it.
-
Memory
Temporal Dead Zone
occurs when declaring a variable with the let and const keywords, but not with var
The time span when that happens, between the creation of a variable’s binding and its declaration
memoization
technique which attempts to increase a function’s performance by caching its previously computed results
BOM
-
consists of the objects navigator, history, screen, location
-
Secure
Same-origin policy
ngăn chặn JavaScript code có thể tạo ra những request đến những nguồn khác với nguồn mà nó được trả về.
-
Miscellaneous
Expression vs Statement
Expression
-
It can be as simple as a single value or more complex with operators, variables, and function calls
-
Statements
-
they are used to control the flow of the program, declare variables, or execute tasks