constructor๋ฉ”์†Œ๋“œ

Class๋Š” ๋ญ๋‹ค? constructor ๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด๋‹ค ์‰ฝ๊ฒŒ ๊ฐ์ฒด๋ฅผ ๋งŒ๋“œ๋Š” ๊ณต์žฅ! prototype ๊ธฐ๋ฐ˜์˜ ๊ฐ์ฒด๋ฅผ ๋งŒ๋“œ๋Š” ๊ณต์žฅ์ด ์žˆ๊ณ , (๋ณด๊ธฐ์‰ฌ์›€) class ๊ธฐ๋ฐ˜์˜ ๊ฐ์ฒด๋ฅผ ๋งŒ๋“œ๋Š” ๊ณต์žฅ์ด ์žˆ๋‹ค. // ์ƒ์„ฑ๋œ ๊ฐ์ฒด๋ฅผ ์–ด๋–ป๊ฒŒ ์ดˆ๊ธฐํ™”? // ๋จผ์ € ์‹คํ–‰๋˜๋„๋ก ๋งŒ๋“ค์–ด์ง„ constructor ํ•จ์ˆ˜๋ฅผ class ๋‚ด์—์„œ ๊ตฌํ˜„ class Person { constructor(name, first, second){ this.name =name; this.first=first; this.second=second; } sum=()=>{ return 'class : '+(this.first+this.second); } } let kim = new Person('kim',10,20); kim.sum = function()..
becky(์ง€์€)
'constructor๋ฉ”์†Œ๋“œ' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก