Tag:es6
-
Time:2020-8-14
With the advent of ES6 specification, the method of defining variables in JS has developed from single var to VaR, let and const. VaR is well known, but what are the new features of these two new products? When should I use it? The following is a detailed explanation of the differences between VaR in […]
-
Time:2020-8-2
Let is different from var for(var i=0;i<5;i++){ setTimeout(()=>{ console.log (i) ; // five 5 },100) } console.log(i);//5 console.log(‘=============’) for(let j=0;j<5;j++){ setTimeout(()=>{ console.log(j);//0,1,2,3,4 },100) } console.log (j) ; // error J is not defined Why can let display the correct result, but not var? VaR is a global scope, which has the function of variable promotion. […]
-
Time:2020-6-25
design sketch demo.html <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <title>Document</title> </head> <body> <script type=”text/javascript”> Let arr = [“front end”, “jQuery”, “JavaScript”, “HTML”, “CSS”]; //Supplementary code let lis=”; let ul = document.createElement(‘ul’); function appendHTML( …innerhtml){ innerhtml.forEach(el => { let templates = `<li>`+el+`</li>`; lis+=templates; }); return lis; } appendHTML(…arr); ul.innerHTML=lis; document.body.appendChild(ul); </script> </body> </html> style.css * […]
-
Time:2020-3-31
An example of this paper describes the new data types of ES6 learning notes. To share with you for your reference, as follows: 1. Data deconstruction assignment 1. Deconstruction and assignment of arrays Basic usage: let [key1, key2…] = [value1, Value2…] Let [name, age, sex] = [‘xiaoming ‘, 24,’ male ‘]; console.log(name); console.log(age); console.log(sex); Note […]
-
Time:2020-3-14
1. Basic usage of object. Assign(): The object.assign method is used to copy all enumerable properties of the source object to the target object. It requires at least two objects as parameters. The first parameter is the target object, and the subsequent parameters are the source object. let targetObj1 = { a: 1 }; let […]
-
Time:2020-3-14
What’s Coriolis for? Let’s first look at the following function Let store = (a, B, c) = > //The function is like a grocery store. Three soft coins are required for a bowl of qizai noodles: A, B, C (five parameters) What’s the function currification? The process of buying noodles may be as follows: Let […]
-
Time:2020-2-23
Problems encountered during code base migration 1. Do not recognize ES6 syntax Extended operators… Error reporting … is the object expansion operator of ES6, which is not supported by Babel at present. A new package needs to be introduced to solve this problem. To install a Babel plug-in to translate the object expansion operator syntax. […]
-
Time:2020-2-1
Conditional compilation refers to the process of selectively compiling the specified code according to the set conditions with the same set of code and the same compilation and construction process, so as to output different programs. Generally used in C + +, Java, C ා, and other compiled execution languages. For JavaScript, we can also […]
-
Time:2020-2-1
This paper gives an example of let and const usage of ES6 learning notes. To share with you for your reference, as follows: In ES6, instead of VaR, variables are declared by let and constants are declared by const. There are some differences as follows: 1. Let and const scopes are limited to the current […]
-
Time:2020-1-31
In this paper, an example is given to illustrate the new knowledge points of string, array, object and function in ES6 learning notes. To share with you for your reference, as follows: 1. Template string Inside the quotation mark is used to input the formatted string text. Within the quotation mark, the expression can be […]
-
Time:2020-1-29
This time I really understand what it means to be “big in the woods, there are all kinds of birds!” I’ve heard about the interview cheat code before, but I just heard about it. It’s a real experience. Come on, bring your own bench and get ready for the melon seeds. Take a good look […]
-
Time:2020-1-26
A component to subscribe to friends online We subscribed to our friends’ online status through ID when we were in didmountAnd to prevent memory leaks, we need to clear the subscription in willunmount But what happens when the friend prop changes when the component is already on the screen? Our component will continue to show […]