javascript array 元素为对象时获取下标
var test = [ {‘id’: 3, ‘value’: 1}, {‘id’: 1, ‘value’: 1}, {‘id’: 15, ‘value’: 1}, {‘id’: 8, ‘value’: 1}, ] 除用遍历获取id为8的下标外,还有没有更高效的获取下标的方式?
var test = [ {‘id’: 3, ‘value’: 1}, {‘id’: 1, ‘value’: 1}, {‘id’: 15, ‘value’: 1}, {‘id’: 8, ‘value’: 1}, ] 除用遍历获取id为8的下标外,还有没有更高效的获取下标的方式?