Day 35 JavaScript ES6

Alright, so today decided to get back in the freecodecamp courses. I ended up finishing the ES6 portion of JavaScript.

ES6 is the latest version of JavaScript. They come with new features, const and let are both more powerful functions than var. Const once used, the variable can’t be reassigned. In other words, it’s an immutable variable except when it used with objects. Let can be reassigned and take new value. It creates a mutable variable

Arrow functions are also a new feature as well. With arrow functions it makes the code shorter and more readable. Arrow functions also come with map, filter, and reduce.

Another new feature is template literals, so that concatenating words no longer use the + operator, but with inside of ${}.

Another new feature in ES6 is default parameters. This is a convenient function because you can literally just type in the value inside the parameter of a function. For example.

So that whatever code is written below the function in the return, the values will show the value in the parameter and not be undefined.

Destruction makes the assignment of the values of an array or object easier to read. It is easier to do since you can group values together in an array. This one still confuses me, but here is an example of it at work. First picture is the old method.

Now here is an example of destruction.

These were the main things I learned about in ES6 in the freecodecamp courses today. Still have like 5 questions left in the course and will go into detail about more ES6 features in the next post.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Up ↑

%d bloggers like this: