-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
미해결
질문드려도 될까요 선생님..
21.07.14 16:25 작성 조회수 130
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와 비슷하게 생긴거 같은데
클레스가 이와같은 원리로 작동한다고 보면 될까요??
답변을 작성해보세요.
답변 0