JavaScript变量复习
var scope = "global"
function f(){
alert(scope)
var scope = "local"
alert(scope)
}
f() // undefined local
等价于
var scope = "global"
function f(){
var scope
alert(scope)
scope = "local"
alert(scope)
}
f() // undefined local
var a = 3.14
var b = a
a = 4
alert(b)
var a = [1,2,3]
var b = a
a[0] = 99
alert(b)
var a = "hello"
var b = a.toUpperCase()
a = b