An implied JavaScript object (e.g. var o = {};
) will always be a truthy value. Since we have no index or length, there is no graceful way to check whether or not these variables have been populated. Here is a simple function to check for an implied object that has no data.
function isEmpty(obj) { for (var o in obj) { return false; } return true; }