首页 > 代码库 > javascipt : filter

javascipt : filter

过滤
 var List = sizes.filter(function (size) {                return size.id == 12;            });

sizes = [

  {id : 10,,stock:130},{id : 11,stock:120},{id : 12,stock:100}

]

 

filter是new一个新的array,然后给他过滤后的对象,最后var list 起来

javascipt : filter