- 取出对象数组中相匹配的值,例如 arr=[{a:1,b:‘b’},{a:2,b:‘c’}] 取出a:1的数据
const data =[...this.url]
let url = data.filter(item=>item.code==this.code)[0]
2,取出对象数组中每个属性title的值,新的数组
let title = item.map(t => t.title)
3,去除list 数组中 和arr 数组相同的数据
let a = list.filter(item => !arr.some(items => item === items))
4,获取数组内对象的索引,匹配条件
a=[{prop1:"abc",prop2:"qwe"},
{prop1:"bnmb",prop2:"yutu"},
{prop1:"zxvz",prop2:"qwrq"}];
index = a.findIndex(x => x.prop2 ==="yutu");
console.log(index);