function Prince(name,age){ this.gender="male"; this.kind=true; this.rich=true; this.name=name; this.age=age; } Prince.prototype.toFrog=function(){ console.log("Prince "+this.name+" turned into a frog."); } var prince=new Prince("charming",25); prince.toFrog();//Prince charming turned into a frog. prince.kind;//true
function common(){ return("爱因斯然"); } common();
原文:http://www.cnblogs.com/Yirannnnnn/p/4899281.html