📜  javascript findindex - Javascript 代码示例

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

代码示例6
const array1 = [5, 12, 8, 130, 44];
const search = element => element > 13;
console.log(array1.findIndex(search));

const array2 = [
  { id: 1, dev: false },
  { id: 2, dev: false },
  { id: 3, dev: true }
];
const search = obj => obj.dev === true;
console.log(array2.findIndex(search));