JavaScript scope
JavaScript Scope
A collection of scope accessible variables.
JavaScript scope
In JavaScript, objects and functions are also variables.
In JavaScript, scope is a collection of accessible variables, objects, and functions.
JavaScript function scope: The scope is modified within the function.
JavaScript local scope
Variables are declared within the function, and the variables are local scope.
Local variables: can only be accessed inside the function.
局部变量在声明的函数内可以访问。myFunction(); document.getElementById("demo").innerHTML = "我的名字叫 " + typeof Name; function myFunction() { var Name = "jack"; }