New JavaScript Elements

Let’s learn about important new elements that have been introduced to JS in ECMAScript 2015+, also known as ES6.

Block-scope variable declarations

ES5 didn’t allow variables delimited by a pair of curly braces, { and }, to be declared or defined by a for loop. Rather, all variables declared with var, even if declared within a block, have either a function scope or a global scope. The new feature of block-scope variable declarations with let and const allows the declaration of local ...