过滤
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 起来
时间: 2024-10-20 09:32:36
过滤
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 起来