ES5原型璉繼承


function add(){};

add.prototype.showName = "MAN";
add.prototype.name = function(){
console.log(this.showName);
}

new add().name();


var cat = {};Object.getPrototypeOf(cat).showName = "dog";cat.__proto__.master = "yang";cat.age = 2;cat["max"] = "歲";alert(cat.showName+""+cat.age+""+cat["max"]+""+cat.master);
相關文章
相關標籤/搜索