πŸ“šΒ ****Reference


πŸ“œΒ Chapter


Constructor function (μƒμ„±μž ν•¨μˆ˜)

Class

Prototype

constructor


constructor() { ... }
constructor(argument0) { ... }
constructor(argument0, argument1) { ... }
constructor(argument0, argument1, ... , argumentN) { ... }
class Person {
  constructor(name) {
    this.name = name;
  }

  introduce() {
    console.log(`Hello, my name is ${this.name}`);
  }
}

const otto = new Person("Otto");

otto.introduce();
constructor() {}
constructor(...args) {
  super(...args);
}