A constructor is a special function that creates and initializes an object instance of a class.
ํด๋์ค ๋ด๋ถ์ ์ธ์คํด์ค ๊ฐ์ฒด๋ฅผ ๋ง๋ค๊ณ ์ ์ธํ๋ ํน๋ณํ ํ์ ์ด๋ค.
The purpose of a constructor is to create a new object and set values for any existing object properties.
์ปจ์คํธ๋ญํฐ์ ๋ชฉ์ ์ ๊ฐ์ฒด๋ฅผ ๋ง๋ค๊ณ , ๊ฐ์ฒด ์ฑ์ง์ ๊ฐ์ ์ค์ ํ๋ ๊ฒ์ด๋ค.
์ปจ์คํธ๋ญํฐ๋ ํธ์ถ๋๋ฉด ์ด๋ป๊ฒ ๋๋๊ฐ?
When a constructor gets invoked in JavaScript, the following sequence of operations take place:
When the this keyword is used in a constructor, it referes to the newly created object:
A constructor can also have parameters.