在list集合中根据某key的值查询对象

//在list集合中根据某key的值查询对象
function searchObjectByKey(list,key,keyValue){
   
   for(var i=0;i<list.length;i++){
      if(list[i][key]==keyValue){
         return list[i];
      }        
   }
   return null;      
}

猜你喜欢

转载自blog.csdn.net/july_young/article/details/84898970