So for example, if we declare variables in a for loop with let, inside an if or in a plain block, it cannot “escape” the block, while vars are hoisted up to the function definition.Ĭonst is just like let, but immutable (sort of!). Also, note that any variables declared with let will be mutable (their values can be changed). The let variable works similarly to var with this key difference. Whilst var can still be used, it’s now discouraged with the push to modern coding standards. It has also introduced a number of new features such as: let/const, arrow functions, a new ‘this’ scope, classes, getters/setters, modules, template literals, default parameters, the spread operator, destructuring, the for.of loop and a whole lot more! let and constĮS6 introduces two new keywords for defining variables: let and const. ECMAScript is the standardization of JavaScript which was released in 2015, hence the name: ECMAScript 2015!Ī great advantage of ES6, is that it allows us to write code in a more modern & readable way. ES6 (or ECMAScript 2015) is the 6th version of the ECMAScript programming language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |