function getConstructiorName(obj) {
return obj && obj.constructor && obj.constructor.toString().match(/function\s*([^(]*)/)[1];
}
getConstructiorName([]) === "Array"; // true
getConstructiorName({}) === "Object"; // true
getConstructiorName(2) === "Number"; // true
getConstructiorName("2") === "String"; // true