Several ways of creating objects in JS
preface
All objects in JavaScript are from Object; All objects from Object Prototype inherits methods and properties, which of course may be overridden. This article mainly introduces several methods of creating objects.
1. Object literal {...}
Object literal is one of the most commonly used methods, which uses curly braces containin ...
Posted by Kyrst on Wed, 12 Jan 2022 08:21:39 +0100
15, Array basis, array method, array sorting
15, Array basis, array method, array sorting
1, Array basis
1.1 three ways to declare arrays
It is recommended to create arrays in the form of array literals
var arr1 = []; //array literal
// The system's built-in Array constructor declares an Array
var arr2 = new Array(); //Not recommended
var arr3 = Array(); //Not used
All arrays (reg ...
Posted by CoffeeOD on Wed, 12 Jan 2022 08:16:02 +0100
String common methods
Common methods of string
There are many methods of string, but there are only those commonly used. Some of them have not been used. Here is a brief introduction
1.charAt(index): returns the values specified in the following table. The returned value is a new string without affecting the original string
let str = 'hello';
let newStr = str.cha ...
Posted by Whyme on Wed, 12 Jan 2022 06:49:54 +0100
VUE -- use VUE print NB to realize printing function
VUE -- use VUE print NB to realize printing function
1, Install Vue print NB
There are no preconditions. You can install it directly, but because vue2 0 and vue3 0 has different usages, so the versions to be installed are also different. Please choose by yourself.
Vue2. Version 0 installation method:
npm install vue-print-nb --save
Vue3. ...
Posted by alvinshaffer on Wed, 12 Jan 2022 05:04:28 +0100
Batch asynchronous update strategy and nextTick principle (code understanding)
let uid = 0;
class Watcher {
constructor () {
this.id = ++uid;
}
update () {
console.log('watch' + this.id + ' update');
queueWatcher(this);
}
run () {
console.log('watch' + this.id + 'View updated~');
}
}
let callbacks = [];
let pending = false;
function nextTick (cb) {
callbacks.pus ...
Posted by AE117 on Wed, 12 Jan 2022 04:00:23 +0100
node.js+mysql learning notes
I'm almost finished. I've sorted out some nodes JS + MySQL notes.
fs module
fs common methods
const fs = require('fs')
// read file
// fs.readFile(path[, options], callback)
// options: indicates the encoding format to read the file (optional). If not selected, it is output as a Buffer object
// Callback: after reading the file, get the r ...
Posted by FrOzeN on Wed, 12 Jan 2022 03:15:32 +0100
Great, new JavaScript proposal: array groupBy()
Author: Ashish LahotiTranslator: front end XiaozhiSource: dmitripavlutinMany developers like the ruby programming language because it has a rich library of standard utilities. For example, arrays in Ruby have a large number of methods.However, our JavaScript is also working hard to gradually enrich its standard library in terms of strings and a ...
Posted by prasitc2005 on Wed, 12 Jan 2022 01:24:29 +0100
[JavaScript Weekly #554] ES2022 feature: class static initialization block
🥳 Welcome interested partners to do something meaningful together! Translator: Natural volumeI launched a weekly translation program, Warehouse address,Access address There is still a shortage of like-minded partners. They are purely personal interests. Of course, they will also help to improve English and front-end skills. Requirements: En ...
Posted by cristiano on Tue, 11 Jan 2022 16:04:50 +0100
Data structure and algorithm - binary search tree and its operation and implementation, defects of binary search tree
catalogue
1, Binary search tree
2, Operation and implementation of binary search tree
1. insert data
2. Traversing binary search tree
(1). Preorder traversal
(2). Medium order traversal
(3). Postorder traversal
3. Maximum and minimu ...
Posted by prkarpi on Tue, 11 Jan 2022 15:37:07 +0100
[condensed essence version] jQuery entry treasure
catalogue
I event processing
1.CDN
2. Baidu resource library
3. Code
II Animation function
III jQuery plug-in
IV jQuery encapsulation principle
1. Advantages of closures
2. Code
V case
I event processing
1.CDN
The full name of CDN is Content Delivery Network, that is, content distribution network. CDN is an intelligent virtua ...
Posted by miligraf on Tue, 11 Jan 2022 12:54:32 +0100