var testFor = function(obj) { for (var i in obj) { alert(typeof obj[i]); } }; var testEach = function(obj) { $.each(obj, function(i) { alert(typeof this); }); }; data = { test: false }; testFor(data); // alerts "boolean" testEach(data); // alerts "object"