在一个对象数组中,根据指定的 key 和 value,查找对应的元素(使用深比较,返回第一个), 并返回其 anotherKey 对应的值,如果没找到,则返回 undefined。
key
value
anotherKey
undefined
对象数组
要查找的指定的 key
要查找的指定的 value
需要返回的值对应的 key
0.0.21
getValueByAnotherValue([{ a: 1, b: 2 }, { a: 2, b: 3 }], 'a', 2, 'b') // 3getValueByAnotherValue([{ a: 1, b: 2 }, { a: 2, b: 3 }], 'a', 3, 'b') // undefined Copy
getValueByAnotherValue([{ a: 1, b: 2 }, { a: 2, b: 3 }], 'a', 2, 'b') // 3getValueByAnotherValue([{ a: 1, b: 2 }, { a: 2, b: 3 }], 'a', 3, 'b') // undefined
在一个对象数组中,根据指定的
key和value,查找对应的元素(使用深比较,返回第一个), 并返回其anotherKey对应的值,如果没找到,则返回undefined。