var test = [
    {
        id   : 'user01',
        pos0 : 2 
    },
    {
        id   : 'user01',
        pos0 : 3 
    },
    {
        id   : 'user02',
        pos1 : 5 
    },
    {
        id   : 'user02',
        pos1 : 6 
    },
    {
        id   : 'user03',
        pos2 : 8 
    },
    {
        id   : 'user03',
        pos2 : 9 
    }
]
This is example data,
and I want if I passed 'pos2', get test[4] and test[5].
//like this : 
function getObjectByKey(array, key){
    // dosomething
};
..
var testArray = getObjectByKet(test, 'pos2');
I tried to use $.inArray or $.map, but how to use them. How can i do this?
Regards.
 
     
    