Skip to main content

Posts

Showing posts with the label ArrowFunction

JavaScript Series (02) — Introducing ES6

The  ECMAScript 2015  aka  ES6 , is the 6th edition of the  ECMAScript  language specification standards. What ES6 did to Javascript was what Java8 did to Java. ES6 came with many new features to enhance the existing language and many new concepts to write clean and concise code. Here are some additions in ES6 1. let & const (Block Scope without Hoisting ) If you’ve coded in Javascript before 2016, you know how vulnerable the  var  keyword made the applications. Using it outside a function was a suicide but even within a function, it created problems due to hoisting. Now, what was hoisting? Hoisting  is  a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution . So no matter where you declare  var , it will always be moved to the top of its enclosing function. So any block within the function will still see the same variable. This doesn’t leave any space to have scopes...