es6 filter方法应用
let arr =[ {title:'aaaa',read:100,hot:true}, {title:'bbbb',read:50,hot:false}, {title:'ccc',read:100,hot:true} ]; //arr.filter() //过滤,过滤一些不合格的元素,如果回调函数返回true,就留下来 let newArr =arr.filter((item,index,arr)=>{ return item.hot }) console.log(newArr)
效果图