function type(target) {
var ret = typeof target;
var obj = {
"[object Array]":"Array",
"[object Object]":"Object",
"[object String]":"String-obj",
"[object Number]":"Number-obj",
"[object Boolean]":"Boolean-obj"
}
if(target==null){
return "null"
}else if(ret =="object"){
var str = Object.prototype.toString.call(target);
return obj[str]
}else{
return typeof (target)
}
}
网友评论