ES6 Variables
 
ES6 Variables     Now,  with ES6, there are three keywords available to define variables: They provide different levels of scope to access the variable. Based on the requirement, you can define variables with these keywords and control its accessibility. var  let const   Using ES6 var Example var  x = 9.9 ; If var declared outside a function, it belongs to the global scope. If var declared inside a function , it belongs to that function. If  var declared inside the block, ex: in a for loop, the variable is still available outside that block. var has a function scope, not a block scope.   Using ES6  let Example   let  x = 9.9 ; let is the block scoped version of var, and is limited to the block, where it is defined. If you use let inside a block, i.e. a for loop, the variable is only available inside that loop. let has a block scope. Using ES6 const Example const   y = 9.9 ;   y=10;   // It will result in an error     constant i...
 
 
