You'd need to iterate through them, but if you're exclusively using
the id to retrieve them you could use this:
var TESTS = {
"1": {
id: 1,
name: 'Test 1',
},
"2": {
id: 2,
name: 'Test 2',
}
};
var
That's an array of objects, and yes, you'll have to iterate through
all of them. jQuery can make it a bit easier but it's not actually
'faster'. I think you meant 'shortest' :)
var idOne = $.grep(TESTS, function(obj){
return (obj.id == 1);
});
- ricardo
On Nov 26, 1:38 pm, Shazzaam <[EMAIL P
2 matches
Mail list logo