087 learning js document object
Reference link: W3school-JavaScript HTML DOM Reference article: Han_python blog JavaScript Column 14
Document object model
Document Object Mode, referred to as DOM. When a web page is loaded, the browser creates the DOM of the page. It defines:
HTML elements as objects, Attributes of HTML elements (can be set or changed) Method (action) t ...
Posted by loureiro on Thu, 28 Oct 2021 17:32:01 -0700
Some thoughts and best practices on react-derived States
Derived state of React
Prior to react 16.3, the only way to update the state s inside a component when props changed was to use componentWillReceiveProps followed by a getDerivedStateFromProps.
There are two scenarios when using a derived state:
Manage a copy of the props passed by the parent component in the state of the child componen ...
Posted by macinslaw on Sun, 24 Oct 2021 09:27:00 -0700
007 - detailed summary of internal knowledge
Member of class attribute Static properties Non static attribute method Static method Non static method constr ...
Posted by Joe_Dean on Sat, 23 Oct 2021 07:46:31 -0700
Detailed explanation of throttling and anti shake of JS
Throttling and anti chattering of JS
Function debounce
Basic concept: the callback is executed within n seconds after the time is triggered. If it is triggered again within n seconds, the timing will be restarted.
Examples without anti shake function
function inputChange(content) {
console.log("inputContent" + content);
}
let input = ...
Posted by rp2006 on Thu, 21 Oct 2021 23:11:20 -0700
js question mark dot (?) - optional chain operator and double question mark (?) - usage of null value merging operator & deconstruction assignment: {data: {Name:'name '}}
js question mark dot (?) - optional chain operator and double question mark (?) - usage of null value merging operator & deconstruction assignment: {data: {Name:'name '}}
1. Question mark dot (?) - optional chain operator
The optional chain operator (?.) allows you to read the value of an attribute deep in the chain of connected objects w ...
Posted by zrueda on Thu, 21 Oct 2021 22:27:39 -0700
js string method
String operation method
1. Convert to string type toString()
(1)var num=110;
var n=num.toString(); //"110"
(2)var num=111;
var n=String(num); //"111"
(3)var num=112;
var n="" + num; //"112"
2. String segmentation returns a new array split()
(1)var str="qingchenghuwoguoxiansheng,woaishenghuo,woaiziji";
var arr1=str.split ...
Posted by dirkbonenkamp on Wed, 20 Oct 2021 18:58:59 -0700
Deep copy and shallow copy
1. What is shallow copy
Create a new object that has an exact copy of the original object property values. If the attribute is a basic type, the value of the basic type is copied. If the attribute is a reference type, the memory address is copied , So if one object changes this address, it will affect the other object.
Above, ` S ...
Posted by pureDesi on Tue, 12 Oct 2021 19:16:12 -0700
What is Promise.allSettled()! Novice and veteran?
What is Promise.allSettled()! Novice and veteran?
Promise.allSettled() Method returns a statement that has been returned in all given promises fulfilled or rejected Posterior Promise, with an array of objects, and each object represents the corresponding promise result.
Next, let's take a look ...
Posted by bobc on Fri, 08 Oct 2021 19:45:57 -0700
3, Basic knowledge
1. Variable declaration
let is used to declare a variable
A variable is not promoted, that is, it cannot be used until it is declared The declaration cannot be repeated It has a block level scope and is only valid in the current scope
const is used to declare a constant
The variable declaration is not promoted, that is, the variable can ...
Posted by gabeanderson on Sat, 02 Oct 2021 12:50:21 -0700
JavaScript native inheritance & & ES6 class inheritance
This article will explain in detail Prototype chain inheritance, constructor based inheritance (call method inheritance), combinatorial inheritance, parasitic combinatorial inheritance, class class class inheritance
1, Prototype chain inheritance
Prototype chain inheritance is to assign a display prototype to the subclass constructor, ...
Posted by phpmaven on Thu, 30 Sep 2021 17:27:19 -0700