The official underscore.js uses this check to find out if something is really an object
// Is a given variable an object?
_.isObject = function(obj) {
return obj === Object(obj);
};
UPDATE
The updated underscore.js library is now using the following, because of a previous bug in V8 and minor micro speed optimization.
// Is a given variable an object?
_.isObject = function(obj) {
return typeof obj === 'function' || (typeof obj === 'object' && !!obj);
};