Category: JS/TS

0

Traverse objects and arrays

Traverse the object: for…in loops through the object’s own and inherited enumerable properties Loops through the object’s own and inherited enumerable properties (excluding Symbol properties). 123

0

Promise Advanced

Promise.all() and Promise.allSettled() Promise.all and Promise.allSettled are both methods for handling multiple concurrent Promises, but they differ in how they handle successful and failed Promis

0

Promise basic

Promise: A new solution for asynchronous programming introduced in ES6. Promises are mainly to solve the previous problem of callback hell. Promise is a constructor that encapsulates an asynchronous

0

Spread operator

Spread operator … (array) The spread operator can split an array or array-like structure into a comma-separated sequence of arguments. 12const arr = [1, 2, 3];console.log(...arr) //result is 1 2 3

0

Arrow Functions, Rest params

Extensions to Functions: Arrow Functions => 123let fn = function(m){return m}; //ordinary functionlet fn = (m) => {return m} //complete writing of arrow functionlet fn

0

Let, Const, Destructuring assignment

Declares variable a by ‘let’ let is the new way to declare variables in ES6, replacing var. 1234let a;let b, c, d;let e = 100;let f = 521, g = 'iloveyou', h = []; var: allows repeated de

0

Closure

Closure When a function is defined, it holds a reference to the external environment in which it exists. This means that a function can access variables in the scope in which it is defined, and thi

0

Function

Definition of function In JavaScript, a function is a reusable piece of code that can be called multiple times. It can accept inputs (called parameters), process these inputs, and return a result (

0

Hoisting

Determine the type of variable typeof operator. Used to determine whether a variable is a primitive type or an object type. 1console.log(typeof(a)) instanceof operator: Mainly used to detect whet

0

Operators

Relational Operators basic: > < >= <= == === (same as ==, but does not allow any type conversions) != (opposite of ==) !== (opposite of ===) == is to determine whether the values ar