js 数组中获取带有某个对象属性的子元素的索引。
let arr = [ { name: 'job', year: 18 }, { name: 'Bob', year: 16 } ] let obj = { name: 'Bob', sex: '男' } const activeIndex = arr.findIndex(d => d.name === obj.name)
本文来自博客园,作者:秋风2016,转载请注明原文链接:https://www.cnblogs.com/lml2017/p/15662766.html