DOM Query in JS

Get parent and sibling nodes. Through a specific node, the following three properties are called to operate on parent and sibling nodes. parentNode property to get the parent node of the current node.previousSibling property to get the previous sibling node of the current node. When the previousSibling attribute is used to remove the previ ...

Added by GingerApple on Thu, 06 Jan 2022 01:42:18 +0200

JS object inheritance

Prototype chain inheritance Idea: let an instance object replace the prototype of the constructor, then the new instance object from the constructor has all the properties and methods of the current object and the methods on the prototype chain. function Parent(age) { this.name = "father"; this.age = age; ...

Added by payjo on Wed, 05 Jan 2022 23:16:21 +0200

Lifecycle of React components

1. Overview of component life cycle Significance: the life cycle of components is helpful to understand the operation mode of components, complete more complex component functions, analyze the causes of component errors, etc.**Component life cycle: * * the process from component creation to mounting to running on the page, and then to componen ...

Added by DickDeeds on Wed, 05 Jan 2022 23:02:50 +0200

Differences among split, slice and split in JS

I often meet these three when doing questions these days. They look very similar. I have to find them every time, so I also record them this time. 1, splice() method The splice() method modifies the array by deleting or replacing existing elements or adding new elements in place, and returns the modified contents in the form of an array. (this ...

Added by premracer on Wed, 05 Jan 2022 19:36:42 +0200

14, Ternary operator, object cloning, shallow copy, deep copy, modular review

14, Ternary operator, object cloning, shallow copy, deep copy, modular review 1, Ternary operator It is also called ternary operator, which is equivalent to the three segment expression of if: var a = 5; if(a > 0){ console.log('Greater than 0'); }else{ console.log('Less than or equal to 0'); } a > 0 ? console.log('Greater than ...

Added by Amtran on Wed, 05 Jan 2022 17:38:26 +0200

[JavaScript] < object oriented > function method & object creation & prototype object & scope analysis

Catalogue 1, JavaScript data type: Classification of objects: 1. Built in objects: 2. Host object: 3. Custom object: 2, Operation of object properties: 3, Basic data type & reference data type: 4, Object creation: Create objects using object literals: Create objects using factory methods: 5, Function function: 1. Creation of f ...

Added by RadGH on Wed, 05 Jan 2022 17:16:59 +0200

day_ Regular expression of 21 JS

1, Regular expression: Verification (validation) of string -- string Regular creation Literal create / match string/ Instantiate object new RegExp('matching string ') / / double slash --- judge whether there are characters in the string that can match good         const reg1 = /good/ / / short for regular expression / / instan ...

Added by Hatch on Wed, 05 Jan 2022 16:19:37 +0200

Huxiang cup 2021 Pastebin recurrence learning

Huxiang cup 2021 Pastebin recurrence learning 1, Introduction to Service Worker Service Worker can be understood as a proxy server between the client and the server. When a Service Worker is registered in the website, it can intercept the request and judge whether to send the request to the server or directly return it to the client through t ...

Added by ashutosh.titan on Wed, 05 Jan 2022 16:08:44 +0200

How do I interrupt an outgoing request?

Recently, I met the problem of how to interrupt the web request that has been sent. I'll discuss it with you here. Interrupt axios request axions interrupt requests can be made in two ways: Mode 1 Use canceltoken The cause factory method creates a cancel token with the following code: import axios from 'axios' const CancelToken = axios.Can ...

Added by nrerup on Wed, 05 Jan 2022 15:24:02 +0200

Getting started with the BootStrap framework

Getting started with the BootStrap framework Download bootstrap source code https://v3.bootcss.com/getting-started/ 2. Download jQuery JS file: https://jquery.com/ 3. Create a new project, copy the dist folder in the bootstrap folder to the project package, and rename it bootstrap; 4. JQuery Copy the js file to the js folder. 5. Layout cont ...

Added by greenhorn666 on Wed, 05 Jan 2022 14:48:02 +0200