📜  过滤方法 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:48:01.133000             🧑  作者: Mango

代码示例6
function filter(array, test) {
  let passed = [];
  for (let element of array) {
    if (test(element)) {
      passed.push(element);
    }
  }
  return passed;
}

console.log(filter(SCRIPTS, script => script.living));
// → [{name: "Adlam", …}, …]