JavaScript (Class, Property & Methods)
Property(속성) : 클래스와 객체에 추가되는 변수 //ES6 constructor(){ this.myProperty ='value' } //ES7 myProperty = 'value' Method: 클래스와 객체에 추가되는 함수 //ES6 myMethod(){...} //ES7 myMethod = () => {...} myMethod = () => {...} 의 장점은 property 값으로 화살표 함수를 사용하기 때문에 this 키워드를 사용하지 않아도 된다. 저번에 했던것 예시 class Human{ constructor(){ this.gender = 'male'; } printGender(){ console.log(this.gender); } } class Person extends Huma..
2023.01.06