Modern JavaScript features which you should be using every day for better development and what problems do they solve.

Thomas Findlay
8 min readJun 2, 2018

The times when JavaScript was only used for adding a little bit of interaction on the website are long gone. New EcmaScript standards are now released every year, bringing more and more useful and powerful features, and JavaScript is not only used on Front-End anymore as one can now also build back-end architecture, mobile, desktop or IOT apps.

I want to share with you a few of the EcmaScript features which I am using on daily basis to improve the efficiency of my development, write a better and easier to read code, as well as why I think that they are just awesome. I will also explain how they can be used and what problems do they solve.

Let / Const

Since I started to use 'let' and 'const' I have never again used 'var' keyword. 'let' was introduced as a replacement for 'var'. Both 'let' and 'const' are block-scoped, while 'var' is function scoped. What it means is that if we for example initialize a 'var' inside a for loop it will also be accessible outside of it.

var animals = ['chicken', 'duck', 'cow'];
for (var key in animals) {
var animal = animals[key];
}
console.log(animal); // cow

--

--

Thomas Findlay

The author of “Vue — The Road To Enterprise” Get the book here — https://bit.ly/3bQenDx. Full-stack web and mobile developer and mentor at www.codementor.io