【JavaScript】__proto__和prototype的區別和聯繫【整理】

var person={name:'ninja'}; person.prototype.sayName=function(){ return this.name; } Chrome運行結果: 提示找不到sayName屬性. js是能夠隨時添加屬性,不過不是針對實例對象自己,而是針對其實例對象所屬的類型對象. eg: var Person=function(name){ this.n
相關文章
相關標籤/搜索