I have associated array:
[
{
"attr_1":"value 1_1",
"attr_2":"value 2_1",
"attr_3":"value 3_1"
},
{
"attr_1":"value 2_1",
"attr_2":"value 2_2",
"attr_3":"value 2_3"
},
{
"attr_1":"value 1_1",
"attr_2":"value 3_2",
"attr_3":"value 3_3"
}
]
And I need to get full object, by requesting ‘value 1_1’, for example. After request I want to see Object 1 and Object 3. I suppose that i need hash, but i don’t know how π
How can I do this correctly?
This is the perfect case for Array.filter!
Array.filter is native in all the browser but not on IE8 and below.
In that case you have to include this polyfill
More info:
http://www.diveintojavascript.com/core-javascript-reference/the-array-object/array-filter