prototype

来源:互联网 发布:mac跑分性能测试 编辑:程序博客网 时间:2024/04/28 22:25

prototype不能用于实例,可以用于对象的建立

 

如:

 

function Car(){

    this.color = "blue";

    Car.prototype.show = function(){

 

    }

}

 

 

而不能用

 

function Car(){

    this.color = "blue";

    this.prototype.show = function(){

   }

}

原创粉丝点击