What's the best way to query an array in javascript to get just the items from it I want?

后端 未结 7 1052
悲哀的现实
悲哀的现实 2020-12-13 18:48

I have an array like this (with just over 3000 objects instead of the 3 here):

items = [{name:\'charlie\', age:\'16\'}, {name:\'ben\', age:\'18\'}, {name:\'s         


        
相关标签:
7条回答
  • 2020-12-13 19:18

    Use the filter method of the array, it calls the provided callbackfunction once for each element in an array.

    array.filter(<callbackfucntion>[, <Object to use>])
    
    0 讨论(0)
提交回复
热议问题