87,996
社区成员




function Person(name,age){
this.name = name;
this.age = age;
}
Person.prototype = {
showName : function(){
return this.name;
}
}
Person.prototype.constructor = Person;
var p = new Person();
function getType( obj ) {
var fName = obj.constructor.toString();
fName = fName.match(/function[\s*]?(.*)\(.*\)/);
if(fName[1]){
return '[object '+fName[1]+']'
}
}
alert(getType(p));