📜  过滤对象 javascript es6 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:19.547000             🧑  作者: Mango

代码示例2
let arr = [
  {name: "John", age: 30},
  {name: "Grin", age: 10},
  {name: "Marie", age: 50},
];

//An array showing persons with age less than 40 
//is given by the following syntax

let newArr = arr.filter(name=>name.age < 40));

console.log(newArray);   // => [{name: "John", age: 30}, {name: "Grin", age: 10},]