get the type of the object,

In 1js, the return value of the reference type typeOf is object;

var b =[]

function getObjType(obj){

return typeof(obj)!=="function"?

undefined:

obj.name||/function (.+?)\(/.exec(obj+"")[1]

//if(obj.name){

// return obj.name //ie8 not supported

//}else{

//var str=(""+b.constructor).replace(/\s/g,"").replace("function","");

//return (str.match(/\w+\(/)+"").replace('(',"")

//return /function (.+?)\(/.exec(obj+"")[1]

}

}

var s=getObjType(b.constructor)

console.log(s)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326121922&siteId=291194637