letobjList=[{name:'tom',age:12},{name:'jack',age:33},{name:'zio',age:12},{name:'lolo',age:89},{name:'robin',age:16},]letageList=[12,16];letgetData=objList.filter((item)=>{returnageList.includes(item.age)});console.log(getData)如上所示,最后打印出来的数据是年龄为1216的元素,想请教各位大佬,如果只是用for循环的方法如何才能过滤对象数组得到想要的数据呢?
紫衣仙女
阿波罗的战车
相关分类