1

ES6 and Ahead

1.ES6 IMPLEMENTATIONS.

<h3>Default Params and concatenation.</h3>

With ES6 it’s possible to assign values by default once the function is being built. So when the function it’s called without arguments it will take those.
Other implementations in the language is the “template literals” ”``” or backticks, that allows the concatenation of several variables easily, For example:
Let concatenation=${variable1}${variable2}

Value1Value2

<h3>Let, Const, Multiline, Spread Operator, and destructuring.</h3>

The differences between const and let reside in the scope both are declared and used.
Another characteristic of the backticks is the multiline property. This means it allows multiple lines meanwhile they are within the backticks limitations.
Destructuring in JavaScript means to open an object layout by layout till it is reached the wished value.
Spread Operators allow to spread of the values of variables, it can be used for example mix arrays in another one. There is the opposite effect, normally used in function when it has to return values together.

<h3>Arrow Functions, Promises, and Parameters in Objects.</h3>

Arrow Functions allows an easy syntaxis. An example from “function(item) {Operation; return result;}  “item => operation” and it returns the result.
Promises to let us work with asynchronism and to resolve the famous “call-back hell”. This promise objects will return a rejection or resolve, one depending on the answer. To catch the response there are “. then” for a positive answer and “.catch” for those rejected.

<h3>Classes, modules, and Generators.</h3>

Classes go with a constructor where we assign variables for a global scope with “this.”. After and out of the constructor are the methods but inside these it’s needed “this.”.
Import and Export with modules. Like in the pre-processors we can transfer code from one page to another within the folders of the projects. This allows us to divide and organize characteristics like requests to APIs.
Generators, this new Feature keeps logic or algorithms and it remembers their position when It is called. To create one generation we do:
Function* generator(){
If(true){
Yield Hello;
}
If(true){
Yield world;
}
};
Finally it’s called:
Const generator1=generator();
Console.log(generator1.next().value)//Hello
Console.log(generator1.next().value)//World
Console.log(generator1.next().value)//Undefined

-2. ES7-

The method includes, in arrays it will say it the value introduced its included inside. It returns a Boolean.
Exponentials are now available with “**” to make the operation.
These were the two main implementations.
##-3. ES8-
To return a matrix is entries, this will help us to know who many elements it has an object. To use it in the object:
Const entries = Object.entries(data);
Console.log(entries.length);
Obect.values(object) it returns the values in an Array.
String.padStart(n,’string’) and string.padEnd(n,’string’) This is more useful for Frontend Developers.

<h3>Async Await</h3>

Async functions allow us to organize promises in the order it is wished. Also, it’s possible to manage the resolve and catch answers with “try{}” and “catch{}” inside the async function.

-4. ES9-

In ES9 it’s found the repose operator, it is really useful when it is wanted to read a certain properties from an object and not the rest for example. To use it :
Let {property1, … all} = obj;
Console.log(property1, all);
Operator to include properties from other object into otherObjt1{…Obt;. Property2}.
“. finally()” after “.catch and .then” it will show a code after the answer it’s sent.
Regex with “.match” it will allows to work with regex separately.

-5. ES10-

Array.flat(depth) -
Array.flatMap(()=>) –
.trimStart() – delete spaces and “.trimEnd” does the same at the end.
Inside catch in Async functions is that catch can use the error inside the scope with not name it before in the parameters.
Now to transform arrays of property and value into Objects ES10 implemented “.fromEntries(array)”.
Finally the object symbol, we can to access the description through the property “.description”.

-6. ES.NEXT-

TC39 https://tc39.es/ . The committee and group of developers of the JavaScript and its future. There are other developers can also contribute with new features.

Escribe tu comentario
+ 2