-프로토타입 문법을 깔끔하게 작성할 수 있는 Class 문법 도입.
-Constructor(생성자) , Extends(상속)
구버전)
var Human = function(type){
this.type = type|| 'human';
}
Human.isHuman = function(human){
return human instanceof Human;
}
Human.prototype.breathe = function(){
alert('h-a-a-a-m');
}
var Zero = function(type, firstName,lastName){
Human.apply(this,arguments);
this.firstName = firstName;
this.lastName = lastName;
신버전
class Human{
constructor(type='human'){
this.type = type;
}
static isHuman(human){
return human instanceof Human;
}
breathe(){
alert('h-a-a-a-m');
}
}