prototype

var book=function(){
// this.prototype.inner = function () { console.log('book_inner') }这种写法是错误的
this.inner2 = function () { console.log('book_inner2')}
}
book.prototype.display=function(){
console.log('display')
};
// book.inner2()//报错
// book.display()//报错
console.log(book.prototype)
console.log(book)
let chebook=new book();
chebook.inner2()//可以执行
chebook.display()

 

 

posted @ 2019-04-29 13:24  ThisCall  阅读(109)  评论(0编辑  收藏  举报