Function.prototype.getName = function(){
return this.name || this.toString().match(/function\s*([^(]*)\(/)[1]
}
function a(){
}
a.prototype.alias = "a_name";
a.prototype.getAlias = function(){
return this.alias;
}
a.tobe = "number one";
function b(){
}
function getInfo(){
var argLen = arguments.length;
for(var i=0;i<argLen;i++){
console.log("\n-----------------------------\n")
var fn = arguments[i];
if(Object.prototype.toString.call(fn)!='[object Function]'){
throw "the parameters must be function";
}
console.log("name:\t"+fn.getName());
for(var p in fn){
console.log("property:"+p+"="+fn[p]+",\tprototype:"+JSON.stringify(fn.prototype));
}
}
}
console.log(JSON.stringify({getInfo:getInfo}))
console.log(a.prototype.getAlias)
getInfo(a,b);