I've got an array: 我有一個數組: 數組
myArray = [{'id':'73','foo':'bar'},{'id':'45','foo':'bar'}, etc.]
I'm unable to change the structure of the array. 我沒法更改數組的結構。 I'm being passed an id of 45
, and I want to get 'bar'
for that object in the array. 我正在傳遞id爲45
,而且我想爲數組中的該對象獲取'bar'
。 this
How do I do this in JavaScript or using jQuery? 如何在JavaScript或jQuery中作到這一點? spa