Scope of variables and constants
- let
- var
- const
There are several ways to start declaring and using variables and constants.
In general the best is to use the let
keyword.
x = "Joe"
var y = "Jane"
let z = "George"
const w = "nothing"
console.log(x) // Joe
console.log(y) // Jane
console.log(z) // George
console.log(w) // nothing