new ์—ฐ์‚ฐ์ž ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ์ฒด ๋งŒ๋“ค๊ธฐ

์ƒ์„ฑ์ž ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜๋ฉด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ ์ œ๊ณตํ•˜์ง€ ์•Š๋Š” ์œ ํ˜•์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฐฝ์กฐํ•ด๋‚ผ ์ˆ˜ ์žˆ๋‹ค. ์ƒ์„ฑ์ž ํ•จ์ˆ˜๋Š” '๊ฐ์ฒด๋ฅผ ์ด๋ ‡๊ฒŒ ๋งŒ๋“ค๊ฒ ์Šต๋‹ˆ๋‹ค'์— ๋Œ€ํ•œ ์ •์˜์ผ๋ฟ์ด๋ฉฐ, ์‹ค์ œ ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋˜๊ธฐ ์œ„ํ•ด์„œ๋Š” new ์—ฐ์‚ฐ์„ ํ†ตํ•ด ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ์ฒด ์ƒ์„ฑ์€ new ์—ฐ์‚ฐ์ž๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. // Dog ๊ฐ์ฒด ์„ค๊ณ„(์ƒ์„ฑ์ž ํ•จ์ˆ˜) function Dog(){ this.name = "๋ฝ€๋ฏธ" this.breed ="์Šคํ”ผ์ธ " } // Dog ๊ฐ์ฒด ์ƒ์„ฑ(new ์—ฐ์‚ฐ์ž) //Dog ๋ผ๋Š” ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ณ , myDog ๋ผ๋Š” ์ด๋ฆ„์„ ๋ถ™์ด๊ฒ ๋‹ค const myDog = new Dog(); console.log(myDog.name) console.log(myDog.breed) ์ƒ์„ฑ์ž ํ•จ์ˆ˜๋Š” '๊ฐ์ฒด๋ฅผ ์ด๋ ‡๊ฒŒ ๋งŒ๋“ค๊ฒ ์Šต๋‹ˆ๋‹ค'์— ๋Œ€ํ•œ ์ •์˜, ์ฆ‰'์„ค๊ณ„๋„'..
becky(์ง€์€)
'new ์—ฐ์‚ฐ์ž ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ์ฒด ๋งŒ๋“ค๊ธฐ' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก