인프런 커뮤니티 질문&답변
질문드려도 될까요 선생님..
작성
·
213
0
function Book(){
console.log(this.point)
}
// Book.prototype.setPoint = function(){
// this.point = 100;
// }
// Book.prototype.getPoint = function(){
// this.setPoint();
// console.log(this.point)
// }
Book.prototype = {
constructor: Book,
setPoint: function(){
this.point = 100;
},
getPoint: function(){
this.setPoint();
console.log(this.point)
}
}
var obj = new Book();
obj.getPoint()
보다보니 class와 비슷하게 생긴거 같은데
클레스가 이와같은 원리로 작동한다고 보면 될까요??
답변
답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!





