Notes - JS modularization

historical background JS itself simple page design: page animation + form submission There is no modular or namespace concept With the increasing complexity of front-end pages, the previous methods can not meet the requirements Therefore, JS has an increasing demand for modularity development history Infancy: no modularization Pages nee ...

Added by nsr500rossi on Sat, 15 Jan 2022 22:27:35 +0200

Array grouping in JavaScript: array groupBy()

Array grouping in JavaScript: array groupBy()Original text: https://dmitripavlutin.com/ja...Due to the rich library of standard utilities, many developers prefer the Ruby programming language. For example, Arrays in Ruby There are a lot of ways.JavaScript has also gradually enriched its standard library of strings and arrays. For example, in th ...

Added by breadcom on Fri, 14 Jan 2022 07:43:38 +0200

Common methods for ES5 and ES6

Common methods for @[TOC] ES5 and ES6 ES5 and ES6 What we call ES5 and ES6 is actually just a version of the js grammarFor example, we use WeChat The earliest version was unpaidOver time, a version emerged that included payment functionality ECMAScript is the syntax of js Previous versions did not have some functionalitySome features we ...

Added by d-fraz on Tue, 11 Jan 2022 19:49:32 +0200

Handwritten Promise (native Promise analysis V -- encapsulated by resolve, reject and other methods)

Preface: before that, we have successively encapsulated Promise, then and all, and explained the mechanism and packaging process. Now, we will go through the remaining simpler methods. 1. race() This method is similar to the all method. The passed in parameter is also an array composed of Promise, but its result analysis is relatively simple. ...

Added by ghostrider1337 on Sun, 09 Jan 2022 05:53:35 +0200

JS iterators and generators

1, Iterator In JavaScript, an iterator is an object that defines a sequence and may return a return value when terminated. More specifically, the iterator is implemented by using the {next() method Iterator protocol The method returns an object with two attributes: value, which is the next value in the sequence; And {done, which is} true if it ...

Added by laide234 on Sat, 08 Jan 2022 22:57:09 +0200

js create object

1. What is an object? Objects are an unordered collection of related attributes and methods, that is, a collection of stored data. Objects are made up of attributes and methods. 2. Three ways of defining objects 2.1 Literal Quantity Definition Object The data units inside the object are stored as key names: key values or attribut ...

Added by kreoton on Sat, 08 Jan 2022 19:59:03 +0200

Set and Map of ES6

Set and Map data structures Set Set is a new data structure of es6. It is similar to array, but the values of members are unique and there are no duplicate values. Set itself is a constructor used to generate a set data structure Usage: const s = new Set(); [1,2,3,3,2,1,6].forEach(x => s.add(x)); for(let i of s){ console.log(i);//1 ...

Added by jackpf on Thu, 06 Jan 2022 01:46:57 +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

[suggested collection] native JavaScript handwriting array API

This article will first understand the usage of array APIs, and then simulate the implementation of these APIs. If you think there is anything wrong, please point out the following! 1. forEach method This method will run the passed in function for each item of the array element without returning a value. This is equivalent to using a for lo ...

Added by alluoshi on Mon, 03 Jan 2022 10:09:07 +0200

"Invincible" 13 Vue modifiers that interviewers like to ask

prefaceHello, I'm Lin Sanxin. As we all know, modifiers are also one of the important components of Vue. Making good use of modifiers can greatly improve the efficiency of development. Next, let's introduce the 13 Vue modifiers that interviewers like to ask1.lazyThe lazy modifier is used to change the value of the input box without changing the ...

Added by knelson on Sat, 01 Jan 2022 07:45:32 +0200