$.each()的用法

var obj = { one:1, two:2, three:3}; 
$.each(obj, function(key, val) { 
    console.log(key);//one   two   three
    console.log(val); //1 2 3
});

var arr1 = [ "aaa", "bbb", "ccc" ]; 
    $.each(arr1, function(i,val){ 
    console.log(i); //0 1 2
    console.log(val);//aaa  bbb  ccc
    
});

 

posted @ 2017-01-18 15:43  小猪冒泡  阅读(261)  评论(0编辑  收藏  举报