jq each遍历数组或对象

var arr = ["北京","上海","天津","重庆","河北","河南","安徽","湖北","湖南"];

$.each(arr, function(i, val) {
  console.log(i+"-- --"+val);
});

var obj= {name:"小明",male:"男"};
$.each(obj, function(i, val) {
  console.log(i+"-- --"+val);
});


function handle(param){
  $.each(param, function(i, val) {
    console.log(i+"-- --"+val);
  });
}

posted on 2019-08-12 18:08 隔壁家的老王头 阅读(...) 评论(...) 编辑 收藏

导航