DEV Community

Cristiano Leal
Cristiano Leal

Posted on

Javascript ES6 - let

The let keyword allows you to declare a variable with block scope.
Example

var x = 10;
// Here x is 10
{
  let x = 2;
  // Here x is 2
}
// Here x is 10
Enter fullscreen mode Exit fullscreen mode

Oldest comments (0)