JavaScript中作用,作用域链和闭包详解 一、作用域在js中有全局变量和局部变量之分:比如var a = 1;function sum(){var b=1console.log(b) //1console.log(a) //2 }sum()conso...