📌  相关文章
📜  在数组 javascript 代码示例中查找元素

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

代码示例6
const inventory = [
  {id: 23, quantity: 2},
  {id: '24', quantity: 0},
  {id: 25, quantity: 5}
];
// Check type and value using ===
const result = inventory.find( ({ id }) => id === 23 );
// Check only value using ==
const result = inventory.find( ({ id }) => id == 24 );