实现检测数据类型的完美方法
function typeof(o){
var _toString=Object.prototype.toString;
var _type={
"undefined":"undefined",
"number":"number",
"boolean":"boolean",
"string":"string",
"[object Function]":"function",
"[object Array]":"array",
"[object RegExp]":"regexp",
"[object Date]":"date",
"[object Erroe]":"error"
}
return _type[typeof o]||_type[_toString.call(o)]||(o?"object":"null");
}
浙公网安备 33010602011771号