for in在对象和数组中的应用
var obj = { name:'lei', be:'dd', age:23 } for(var poo in obj){ alert('对象的属性和值为:'+poo+':'+obj[poo]); } var arr = [12,454,'dafda','feagfag']; for(var a in arr){ alert('数组的下标以及值为:'+a+':'+arr[a]); }
var obj = { name:'lei', be:'dd', age:23 } for(var poo in obj){ alert('对象的属性和值为:'+poo+':'+obj[poo]); } var arr = [12,454,'dafda','feagfag']; for(var a in arr){ alert('数组的下标以及值为:'+a+':'+arr[a]); }