상세 컨텐츠

본문 제목

[자바스크립트] 클래스 생성자===클래스

카테고리 없음

by esoesmio 2023. 5. 7. 23:21

본문

class StaticMethodCall {
    constructor() {
        console.log(StaticMethodCall.staticMethod());
        // 'static method has been called.'

        console.log(StaticMethodCall.constructor().staticMethod());
        // 'static method has been called.'
    }

    static staticMethod() {
        return 'static method has been called.';
    }
}

as  =new StaticMethodCall();


console.log(StaticMethodCall.staticMethod());
console.log(this.constructor.staticMethod());

댓글 영역