Why not check Number - a bit shorter and works in IE/Chrome/FF/node.js
function whatIsIt(object) {_x000D_
if (object === null) {_x000D_
return "null";_x000D_
}_x000D_
else if (object === undefined) {_x000D_
return "undefined";_x000D_
}_x000D_
if (object.constructor.name) {_x000D_
return object.constructor.name;_x000D_
}_x000D_
else { // last chance 4 IE: "\nfunction Number() {\n [native code]\n}\n" / node.js: "function String() { [native code] }"_x000D_
var name = object.constructor.toString().split(' ');_x000D_
if (name && name.length > 1) {_x000D_
name = name[1];_x000D_
return name.substr(0, name.indexOf('('));_x000D_
}_x000D_
else { // unreachable now(?)_x000D_
return "don't know";_x000D_
}_x000D_
}_x000D_
}_x000D_
_x000D_
var testSubjects = ["string", [1,2,3], {foo: "bar"}, 4];_x000D_
// Test all options_x000D_
console.log(whatIsIt(null));_x000D_
console.log(whatIsIt());_x000D_
for (var i=0, len = testSubjects.length; i < len; i++) {_x000D_
console.log(whatIsIt(testSubjects[i]));_x000D_
}
_x000D_