JavaScript ES6

Shahidul Islam
3 min readMay 5, 2021

--

ES6 stands for ECMAScript 6. ES6 was published in June 2015.

Easy to understand : JavaScript Version 6 is ES6

JavaScript New Features in ES6

let and constants

ES6 introduced two new JavaScript keywords : let and constants

  • Let And Const provide Block Level Scope variables in JavaScript.
Code
Example Of Let and constants

Let Vs Const

let and const almost exactly the same. However, the only difference is When you Have assigned a value to a variable using Let, you can reassign In a new value

But you can not reassign in a new value with Using Const.

Code
Example Of Let Vs constants

Arrow Functions

An arrow function expression is alternative to traditional function. It’s allows to a short syntax for writing A function in JavaScript.

Code
Example Of Arrow Functions

For/Of

So Simple Way To Loop In An Array. Use For/Of Method

For/Of Loop statement loops through on the values of an iterable objects.

For/of Method provides loop String, Array, array-like objects, TypedArray, Map, Set, and user-defined iterables and More...

  • iterable means : An object that has iterable properties.
For/Of Code
For/Of Example

Default Parameter

The default parameter is set default values for a function parameters. When a value Is not passed then you can face undefined. In this case, the default value applied for Your Function

Default Parameter Example

spread operator

The spread operator for arrays was introduced in ES6.

It takes in an iterable (Like an Array) and expands it into individual elements.
Using this operator makes code concise and readability.

Example spread operator

Array find

The find method returns the value of the first array element that passes a test function.

If not values match the testing function. Then return undefined.

Example Of Array find

isNaN

Nan Means Not A Number

The isNaN() function check the value is an illegal number (Not-a-Number)

It’s returns true if the value is NaN. Otherwise it returns false.

Example : isNaN

Symbol

Symbol is a primitive data type of JavaScript, along with string, number, boolean, null and undefined.

It’s a Unique data type. Once you have create a symbol, its value is kept private for internal use.

Symbol Example Code

Template literals

Template Literal allow dynamic strings.
use the backtick (` `) character for Create template Literal.

You Can use of double or single quotes inside Template literals

Template Literal Code

Template Literal syntax we have what are called expressions.
Like this: ${expression}.

Template Literal expression

--

--