
正文
JavaScript Return Object.Type
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
var getType = function(obj) {
if (obj == null) {
return String(obj);
}
return typeof obj === 'object' || typeof obj === 'function' ? obj.constructor && obj.constructor.name && obj.constructor.name.toLowerCase() || /function\s(.+?)\(/.exec(obj.constructor)[1].toLowerCase() : typeof obj;
};






