Example of for-of block in Javascript ES6
While in previous tutorials, we used the forEach method to iterate through all the elements of an array; now we can use the for-of construct like this … And you get the results as...
read moreExample of class in Javascript ES6
Here is an example of a class with constructor in Javascript ES6… The class name “Animal” is typically capitalized. The instance variable “person” is not. You...
read moreDestructuring in Javascript ES6
Here we have an object “john” assigned to “employee”. If we want to extract out the property value of “name” into a variable “n”. And the property...
read moreconst keyword in Javascript ES6
The “const” keyword has the same block scope as the “let” keyword as shown in previous tutorial. With const, whatever was assigned, can not be changed… Note that once...
read moreArrow functions in Javascript ES6
Continuing from the last tutorial, we changed the anonymous function in an arrow function like this… This is equivalent to use of anonymous function… but is much more concise. You drop...
read moreTemplate Strings in Javascript ES6
To show you template string in Javascript ES6, we continue directly from last tutorial but with one line changed… The result is the same. Instead of using the single of double quotes to mark...
read morespread operator in Javascript ES6
The spread operator in Javascript ES6 uses three dots … It also returns 15 to the browser. Except that the dot-dot-dot is in the caller and not in the function definition. The function...
read moreRest parameter in ES6
In this ES6 example, we define function “adder” with a “rest parameter” called “numbers”. Note the three dots before the parameter name in the function...
read moreDefault function parameters in ES6
Here is an example of using default function parameters in ES6: You see that the browser displays “Hello John” because we passed in the value “John” into the sayHello...
read moreAll contents are opinions and are copyrighted and may contain display ads and ad links for which site may receive revenues from.
See Terms of Use and Privacy Policy.