참조 : 동일한 기능을 구현할 수있는 ECMAScript를 5 준수 방법이 있다면 내가 궁금 http://ejohn.org/blog/simple-class-instantiation/존 레식의 간단한 클래스의 인스턴스와 "엄격한 사용"
// makeClass - By John Resig (MIT Licensed)
function makeClass(){
return function(args){
if (this instanceof arguments.callee) {
if (typeof this.init == "function")
this.init.apply(this, args.callee ? args : arguments);
} else
return new arguments.callee(arguments);
};
}
. 문제는 엄격한 모드에서 arguments.callee
에 액세스하는 것이 더 이상 사용되지 않습니다.