ES2015 Scope & Hoisting - let & const
ES2015 introduces two new ways to declare variables. The keywords
const. If you’re not familiar with these yet, here are the basics of these two keywords.
let is similar to
var. It allows us to declare variables in our local scope. It’s used the same way,
let x = 4;. The differences are that
- not hoisted
We’ve seen that variable declarations using
var get hoisted to the top of their scope.