method

    [mdn, 드림코딩 외] 객체지향 (3) : 정적 속성과 메소드(static properties and methods)

    정적 속성과 메소드(static properties and methods) static 키워드를 붙이면 프로퍼티나 메소드가 인스턴스화되지 않고 클래스 자체에 붙는다. class goodCoder { static codername = 'noran'; constructor(coderNumber) { this.coderNumber = coderNumber; } static printCoder() { console.log(goodCoder.codername); } } const coder1 = new goodCoder(1); const coder2 = new goodCoder(2); console.log(coder1.codername); //undefined 위 코드에서 console.log(coder1.cod..