//**생성자함수를 class로 변경하기 (ES6)
//javascript는 프로토타입의 프로그램언어인데 안정적이고 신뢰도가 높은 class 개념을 다른 언어에서 착안하여 직관적이고 간결하게 활용도 높게 나타낸다
// function User(first,last){
// this.firstName = first;
// this.lastName = last;
// }
// User.prototype.getFullName = function(){
// return `${this.firstName} ${this.lastName}`;
// }
class User {
//내부함수constructor(매개변수a,b)
//constructor:function(){} 의 축약형임
constructor(first,last){
this.firstName = first;
this.lastName = last;
}
getFullName(){
return `${this.firstName} ${this.lastName}`;
}
}
const mag = new User('mag','hwang');
const amy = new User('amy','choi');
const pheter = new User('pheter','park');
console.log(mag.getFullName());