udemy에서 강의 듣는데 (js전용 강의는 아니고 풀스택쪽 html/css/js/node.js )
function Person(name, age, skill) {
this.name = name
this.age = age
this.skill = function () {
...
}
}
이런식으로 하던데
구글링해보니까 class 있긴한데 내가 보고있는 강의 목차에는 class는 따로 설명 없는것 같던데
현대의 js는 class대신 function으로 대체하는거냐 머냐??
ㅇㅇ 대충 감잡은거 같은데 자스는 class-based가 아니고 prototype-based임
해당 댓글은 삭제되었습니다.
해석이 조금 모호한데 영문페이지 원문은 이거임 JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript.
저건 옛날 방식이고 js도 클래스 필요하면 키워드 있음
그럼 클래스 쓰는게 더 요즘 방식이란거임?
그래. 예전에는 클래스가 없어서 함수로 대충 흉내내다가 요새 클래스가 생긴 거야
클래스 궁금하면 javascript.info에서 클래스 파트 보셈 제일 자세한 편임
걍 클래스써 언제적 코드야 저게 씨발ㅋㅋㅋ