Leo Liu's blog

Archives · 2022

Home

About

Archives

Javascript

The Var, let, Const - What's the Difference?

Aspect var let const Scope Function scope; variable is accessible inside function even if declared after usage Block scope; variable is only accessible inside nearest enclosing {…} Block scope; variable is only accessible inside nearest enclosing {…} Re-declared Can re-declare var anywhere in the function Cannot re-declare let in the same block Can..

Read more