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')