//---------for用来遍历数组对象 var i,myArr = ["a","b","c"]; for (var i = 0; i < myArr.length; i++) { console.log(i+":"+myArr[i]); }; //---------for-in 用来遍历非数组对象
方法一、
var man ={"1":"a","2":"b","3":"c"}; for(var i in man) { console.log(i,":",man[i]); }
方法二、
var man ={"1":"a","2":"b","3":"c"};
$.each(man, function(i){
console.log(i,":",man[i]);
});