Javascipt :filter filter introduction and use

  • 2020-03-30 03:56:20
  • OfStack

Javascript: filter  filter


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

sizes = [
  {id : 10,,stock:130},{id : 11,stock:120},{id : 12,stock:100}
]

The filter is a new array, and then you give it the filtered object, and then the var list is added


Related articles: