프로그래밍
-
Class vs Object프로그래밍/Js 2020. 8. 3. 20:24
javascript는 프로토타입 기반으로 객체 생성을 지원하는 동적 스크립트 언어이다. * 프로토타입 : 달리 클래스를 명확히 정의하지 않아도 되며, 속성과 메서드를 다른 클래스의 인스턴스나 빈 객체에 추가하는 작업을 덜 수 있는 프로그래밍 스타일 1.class template declare once no data in ex) 붕어빵틀 2.class instance of a class created many times data in ex) 크림 붕어빵, 팥 붕어빵 3. class declarations class Person { constructor(name, age) { this.name = name; this.age = age; } speak() { console.log(`${this.name} : ..