Skip to content

Instantly share code, notes, and snippets.

@YounglanHong
Last active June 17, 2020 09:05
Show Gist options
  • Save YounglanHong/71ebd360bc0321b9bb3bc138417619a3 to your computer and use it in GitHub Desktop.
Save YounglanHong/71ebd360bc0321b9bb3bc138417619a3 to your computer and use it in GitHub Desktop.
class Coffee {
// constructor로 객체 초기화
constructor(menu, origin, roasting) {
this.menu = menu;
this.origin = origin;
this.roasting = roasting;
}
order() {
console.log(this.menu, "주문이 완료되었습니다")
}
}
// new 키워드로 생성된 인스턴스
const coffee = new Coffee("latte", "Colombia", "Medium");
console.log(coffee.menu, coffee.origin, coffee.roasting);
coffee.order();
// 출력
// latte Colombia Medium
// latte 주문이 완료되었습니다
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment