1 Object.getPrototypeOf . The method can be used to get the parent class from the subclass. Therefore, you can use this method to determine whether a class inherits another class.2, super this keyword, can be used as a function, can also be used as an object. In both cases, its usage is completely different.The first case, super as a function call, represents the constructor of the parent class. ES6 requirements, the constructor of a subclass must per
React is a JavaScript library for building user meetings.React is primarily used to build the UI, and many people think that react is the V (view) in MVCReact originated from Facebook's in-house project to set up Instagram's website and open source in May 2013.React has a high performance, and more and more people are starting to focus on and use it.For example, a simple counter implementation:React.min.js Detailed: React Core libraryReact-dom.min.js: Providing DOM-related featuresReactdom Class
functionshow (flag) { console.log (a); if (flag) { vara= ' GHOSTWU '; returna; }else{ console.log (a); returnnull; }} We lifted the variable from es5 Functionshow (flag) { Vara;console.log (a); if (flag) { a= ' GHOSTWU '; returna; }else{ console.log (a); return null;} }This mechanism, often misleading programmers in the project, even the senior front-end programmer, careless and easy to enter the pit, so ES6 introduced a block-level scope to stren
Then the above [JS Master Road] ES6 series tutorial-iterator and builder details continue.A new loop structure was introduced in ES6 for ... of, mainly used to iterate over an iterative object, so what is an iterative object?An iterative object typically has a Symbol.iterator property, and you can print an array with Console.dir in the console, Map,set, which can be found on their prototype object (prototyp
JavaScript,JavaScript is a scripting language with its own syntax and semantics, without JavaScript, and no other concepts.About ES6, which can be directly understood as the enhanced version of JavaScript (adding new specifications, features and functionality) or the latest version, although slightly different, but also can be ignored (do not care about these details, hehe), a bit similar to the JAVA8 and Java language relationship, Also since there a
{let arr= Array.of (3, 4, 7, 9, 11); Console.log (' arr ', arr);//[3,4,7,9,11]Let empty =Array.of (); Console.log (empty); //[]}//ES6 adds the FROM function to array to convert other objects into arrays. //of course, other objects are also required and not all, and two objects can be converted to an array. //1. Objects with iterator interfaces are deployed, such as: Set,map,array. //2. Class Array object, what is called the class array object, is an o
Deconstruction Assignment of arraysES6 allows you to extract values from arrays and objects in a certain pattern, assigning values to variables, which is called deconstruction (destructuring).Previously, assigning a value to a variable could only be specified directly.let a = 1;let b = 2;let c = 3;ES6 allowed to be written as follows.let [a,b,c] = [1,2,3];console.log(a); // 1console.log(b); // 2console.log(c); // 3The following will also be parsedlet
CP from:https://www.cnblogs.com/ricoliu/p/5996149.htmlMet with a puzzle that was originally called ES6, and now suddenly becomes es2015.The reason for this is the sixth change in ecma-262, all formerly known as ES6.But in order to be released frequently for smaller versions, it is now the standard term: Esmascrip 2015Baidu Information:As of the release date, the official name of JavaScript is ECMAScript 201
Installing BabelThe official documentation suggests that we install locally based on a single project because different projects can rely on different versions of Babel to make your project more portable and easier to install.Use the command line tool (CMD, etc.) in the root directory of the project to execute the following codenpm install --save-dev babel-cliInstall compilation rulesThe official set of preset sets of rules are available for some of the experimental features of ES2015, React, an
Objective
For JavaScript, classes are optional (not necessarily) design patterns, and implementing classes in [[Prototype]] languages like JavaScript is lame.
This kind of lame feeling is not just from grammar, although grammar is a very important reason. JS has a lot of grammatical shortcomings: cumbersome and messy. Prototype refers to explicit pseudo polymorphism when attempting to invoke a function of the same name on the upper layer of the prototype chain and is unreliable, unattractive,
Variables declared by let and Const are valid only within the code block
{Let
a = ten;
var b = 1;
}
A//REFERENCEERROR:A is not defined.
b//1
There is no variable elevation
Variables must be used after declaration, otherwise the error
var tmp = 123;
if (true) {
TMP = ' abc ';//Referenceerror let
tmp;
}
Do not allow duplicate declarations
Error
function () {Let
a = ten;
var a = 1;
}
Block-level scopes
function f () {Console.log (' I am outside! ');}
Objective
A few years ago, when SpiderMonkey implemented a rigorous model. I learned that strict mode disables the octal integer literal. Because there is evidence that some beginners will use the leading 0来 to align numbers in multiple lines, leading to unexpected results:
var sum = 015 +//equivalent to decimal 13, rather than
197 +
001; Anyway it's 1
console.log (SUM)//Added and is 211, not the novice thinks 213
But there are still a number of developers who need to oc
Let is the new copy command inside the ES6, let assignment commands can only be invoked in the {} code block. Here is an example to explain the Let command in Es6, the details are as follows:
The use of the 1.let command is similar to the Var command, but the variable declared by the Let command is valid only within the code block of Let
{Let
a=10;
var b=1;
}
Console.log (a);//uncaught referenceerror:
";
var x=new Array (' LZ ', ' h ', ' is ', ' a SB ');
For (Let I of x) {
console.log (i);
}
Output
LZ
H
is
a SB
There are some differences
differences when working with object objects
For-of is the ES6 standard, which existed prior to this For-in object also as an iterator, traversing the names of the objects ' properties and methods:
"Use Strcit";
Added 4 properties to this object 2 methods
var ok={
sb1: ' LZ ',
SB2: ' H ', SB3: ' Is
Preface:
because mixin is contrary to JavaScript semantics, React ES6 uses higher-order components instead of mixins. In This section, we will focus on how to replace the traditional React mixins with higher-order components. How do we use ES6 to handle mixin?
What is a high-order component?
Adding logic to an existing component class through a function is a higher-order component.A higher-order component
Three, ArrayThe array object adds some new static methods, and some new methods are added to the array prototype.1.array.from to create an instance of an array from an array of classes and traversed objects Class array objects include: arguments in Functions, NodeList objects returned by document.getElementsByTagName (), newly added map and set data structures.In ES6 class array conversion method let Itemelements=document.queryselectorall ('. Item ')
This is a creation in
Article, where the information may have evolved or changed.
ES6 allows values to be extracted from arrays and objects (as well as strings, values, Booleans, function parameters, and so on) in a certain pattern, which is called a deconstructed assignment, by assigning a value to the variable in the corresponding position. First, assuming that you already know what a deconstruction assignment is, let's take a quick look at its comm
1. codePointAt method is the simplest way to test whether a character consists of two bytes or four bytes.1 function Is32bit (c) {2 return c.codepointat (0) > 0xFFFF; 3 }45// true6// false2.ES6 provides methods for string instances to normalize() unify different representations of characters into the same form, which is called Unicode normalization.normalizeMethod can accept four parameters.
NFC , the default parameter, means "standard
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.