📅  最后修改于: 2022-03-11 15:03:09.302000             🧑  作者: Mango
function filter(array, filterfunc) {
let filteredArray = [];
for (let i = 0; i < array.length; i++) {
let result = filterfunc(array[i], i, array);
if (result) {
filteredArray.push(array[i]);
}
}
return filteredArray;
};