중복을 제거하는 방법;팩토리 패턴, 프로토타입
To avoid duplication : Factory pattern, prototype
var 프로토타입 = {
type: '카드',
attack: function() {},
defend: function() {},
};
function 카드공장(name,att,hp) {
var 카드 = {
name: name,
att: att,
hp: hp,
}
카드._proto_ = 프로토타입
return 카드;
}Last updated