constructor

Constructor function(์ƒ์„ฑ์ž ํ•จ์ˆ˜) ๊ฐ์ฒด ์–‘์‚ฐ ํ•จ์ˆ˜, ์ฆ‰ ๊ฐ์ฒด๋ฅผ ์ฐ์–ด๋‚ด๋Š” ํ•จ์ˆ˜์ด๋‹ค. ์ด์ „์—๋Š” ํ•˜๋‚˜์˜ ๊ฐ์ฒด๋งˆ๋‹ค ํ‚ค์™€ ๊ฐ’์„ ๋ถ€์—ฌํ•ด์คฌ๋‹ค๋ฉด, ์ปจ์ŠคํŠธ๋Ÿญํ„ฐ์™€ new ๋ผ๋Š” ๊ฐ์ฒด์ƒ์„ฑ ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปจ์ŠคํŠธ๋Ÿญํ„ฐ์— ์ •์˜๋˜์–ด ์žˆ๋Š” ์†์„ฑ๊ณผ ๋ฉ”์†Œ๋“œ๋ฅผ ํ•œ๋ฒˆ์— ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ๊ณ , ๊ฐ๊ฐ์˜ ๊ฐ’์€ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ๋ฐ›์•„ ๊ฐ ์ƒํ™ฉ๋งˆ๋‹ค ๋ณ€๊ฒฝํ•˜์—ฌ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. // ํ•จ์ˆ˜์— ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด์ค€๋‹ค function Person(name,first,second,third){ this.name =name; this.first=first; this.second=second; this.third=third; this.sum=function(){ return this.first+this.second+this.third; } } // ์ƒ์„ฑ์žํ•จ์ˆ˜..
becky(์ง€์€)
'constructor' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก