댓글 검색 목록

[javascript] 자바스크립트에서 클래스를 정의하는 법

페이지 정보

작성자 운영자 작성일 17-12-23 11:05 조회 1,447 댓글 0

클래스 정의

class Pencil {
    constructor(price) {
        this.price = price;
    }

    isExpensive(){
        return this.price >= 10;
    }
}

//usage
const bic = new Pencil(3);
bic.isExpensive();


댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.