A.1. New in ES6
Since 2015, ECMAScript 6 has offered new syntax and conventions for developing with JavaScript. For that reason, this book covers some of the ES6 keywords and formats you’ll use. Keywords are terms that have a reserved meaning in JavaScript and are used to provide the syntax and interpretability of your code.
A.1.1. The let keyword
You’re probably used to declaring variables with the var keyword. With ES6, it’s more appropriate to use the let keyword to define variables as they apply to a specific scoped block. Until a variable is defined within a particular block of code, you can’t access it.
A let variable defined in an if block can’t be accessed outside the block, for example, whereas a var variable is scoped to the function ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access