0
爲什麼howdothisvargetchanged
在解析到changevar
後得到不同的值? 當變量只存在於作用域之外時,它如何被函數改變?功能改變變量之外的變量
(function()
{
var howdoesthisvargetchanged = {'a': 'a', 'B': 'B', 'C': 'C'};
console.log(JSON.stringify(howdoesthisvargetchanged));
changevar(howdoesthisvargetchanged);
console.log(JSON.stringify(howdoesthisvargetchanged));
function changevar(v)
{
v['C'] = 'why does this work?';
}
})();