Scope determines the accessibility (visibility) of variables. JavaScript has three types of scope.
var inside a functionlet/const inside {}A closure is a function that remembers variables from its outer scope even after the outer function has returned.
Edit the code below and click Run to see the result live.