A local-function variable having the same name as a global variable shadows the global variable inside the function. They are accessible within the defining function only. Local-Function Scope: var-variables declared inside a function definition have local-function scope.They can be accessed from any part of the script. Global Scope: var-variables declared outside functions have global scope.Prior to ES6, you could only use the keyword var to declare a variable. The var, let and const Variable Declarations This article describes the new features introduced in ECMAScript version 6 (or ES6, ES2015, ES6Harmony), formerly known as "ECMA-262 ECMAScript Language Specification 2015".Īll the examples are tested under Node.js (see "Node.js How To" on how to setup and run JavaScripts).įor brevity, cleaner-looking and more meaningful codes, I omit the ending semicolons use single quote for string avoid foo-bar, i, j, k use const instead of let and var keep the sentences short and brief.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |