7 ES6 Features Recommended For Getting Started with ES6

User Image YUVRAJ HINGER 2 weeks ago | Programming paradigm
7 ES6 Features Recommended For Getting Started with ES6
Share

Introduction

In this article you find seven es6 features that would be recommend to learn first if you are just getting start with es6.

Seven ES6 features that you should learn if you are just Getting Started with ES6

1. let and const keywords

The first feature is the let and const keywords for variable declarations.

What you need to learn here is the difference between VAR let and const keywords 

They all are used to declare variables so understand when to use one over the other.

2. arrow functions

The second feature is arrow functions.

When it comes to arrow functions there are two important things to concentrate on 

The first one is the syntax you will get to know that for single parameter you can omit parentheses, for a single statement within the body you can leave out curly braces and also the return keyword. but multiple parameters you need the parentheses and multiple lines in the body you need curly braces.

The second concept is related to this keyword in regular functions every new function defined has its own this keyword value that would confuse people getting started with JavaScript. arrow functions on the other hand don't have their own this keyword. 

so please make sure you understand the concept of this keyword when it comes to arrow functions versus traditional functions 

3. template literals

The third feature is template literals.

With template literals you can write multi-line strings and embed expressions right into the string. you need to make use of backticks to write template literals 

This is a feature that really helps save time because we can avoid the whole confusion when concatenating strings with values and having to escape single and double quotes.

The simplest yet one of the most useful features in es6.

4. default parameters

This is a pretty straightforward concept, you can basically specify default values to parameters when you define a function. when you call that function and don't pass in a value the default value will be used.

5. object literals

You're going to learn that with es6 if the property name and the value name is the same in an object we can omit the value and the value is inferred to be the same as the property name.

it is also possible to use variables as object keys.

so the next time you come across code where they return an object but the object doesn't have key value pairs they're using es6 object literals.

6. rest and spread operators

Rest operator is used to represent an unknown number of values as an array and is useful when specifying parameter to a function whose value may vary at runtime.

The spread operator as the name indicates is used to spread or expand and iterable like an array.

do learn the syntax and the uses of rest and spread operators 

7. destructuring assignment

seventh feature is the destructuring assignment, destructuring is kind of a special assignment which works with arrays and objects.

so learn about destructuring arrays but more importantly destructuring objects as that is something you're going to find more often.


Summary

1. let and const 

2. arrow functions 

3. template literals 

4. default parameters 

5. object literals 

6. rest and spread operators 

7. destructuring assignment 

these are the seven features that would be recommend if you are getting started with es6, forget about the other features and focus on learning these for a week or two.

once you have a good understanding move on to the lights of classes modules promises iterators and so on.

alright I hope that you now have some direction to begin with es6.

Thank you guys for reading this article.

If you find this article helpful please like & share it with your friends.


 


Share

Comments

Leave a reply

Like