标签:class style console bsp -- for 对象 code var
//---------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]);
});
标签:class style console bsp -- for 对象 code var
原文地址:http://www.cnblogs.com/liujiaq/p/6126948.html