How do I access the name of an item in an Object Literal using jQuery?
For example how would I read \"title\", \"link\", \"media\", ect... in this
{
You can also use the $.each function:
var obj = { one:1, two:2, three:3, four:4, five:5 };
$.each(obj, function(key, value) {
//..
});
If you go for the for...in statement way, I would recommend you to check if the property resides directly on the object being iterated, because you could have some issues, if the Object.prototype is extended:
for(var key in obj) {
if (obj.hasOwnProperty(key)){
// value = obj[key];
}
}