Record what was the use of an array of filters
The filter will create a new array, the array does not change the original
Syntax: Array = new non-empty source array .filter ((entry index, the original array) => {
Screening was business logic
})
eg:
let oldArr = [ { name:'tom', age:13 }, { name:'tom2', age:14 }, { name:'tom3', age:15 }, { name:'tom4', age:16 }, ]; let newArr = oldArr.filter((item, index,arr)=>{ return item.age>15 }); console.log(oldArr.length) //4 console.log(newArr.length) //1