Skip to content
Advertisement

Tag: scope

What is the scope of variables in JavaScript?

What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally? Answer TLDR JavaScript has lexical (also called static) scoping and closures. This means you can tell the scope of an identifier by looking

Advertisement