Archive: 2021

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

setState()

Data in React state cannot be changed directly The code in the example is to directly change (wrong) 1234changeWeather(){ const isHot=this.state.isHotthis.state.Hot=!isHot //Error!console.l

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

Class components

Create class components If the class defines the component, the class must inherit React’s built-in class: React.Component 1class MyComponent extends React. Component{} Among them, the co

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

0

Class knowledge review

Console output class Red represents that the output is an instance object, and blue represents who created the instance object. Person {} If the constructor of the class does not receive parameter

0

Component

Module and component definitions Module: Generally, a .JS file is a module (developed by function) Component: A collection of JS+HTML+CSS code and resources (developed by region) Developer Tools R