js的变量的有效域

  

function test(o)
{
    var i=0;
    if(typeof o=="object")
    {
        var j=1;
        for(var k=0;k<10;k++)
        {
            console.log('loop in:'+k)
        }
        console.log('loop out:'+k)
    }
    console.log(j)
}


test([1,2,3,4])
test('wcfwcfwcf')
原文地址:https://www.cnblogs.com/aomi/p/7371438.html