목록js prototype (1)
프론트엔드 개발

JS에서 prototype이 필요한 이유 function Person(name, fir, sec, thi) { this.name = name; this.fir = fir; this.sec = sec; this.thi = thi; this.sum = function() { return this.fir + this.sec + this.thi; } } const kim = new Person('kim', 100, 100, 100); console.log(kim.sum()); // 300 kim.sum = function(){ return (this.fir + this.sec )/ this.thi } console.log(kim.sum()); // 2 const park = new Person('park', 5..
Front-End/Javascript
2021. 3. 19. 02:45