티스토리 뷰
출처 : http://javascript.crockford.com/prototypal.html
Object.prototype.begetObject = function () {
function F() {}
F.prototype = this;
return new F();
};
newObject = oldObject.begetObject();if (typeof Object.create !== 'function') {
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
}
newObject = Object.create(oldObject);'웹개발 > Javascript' 카테고리의 다른 글
| 자바스크립트 SOLID 원칙 (0) | 2014.02.26 |
|---|---|
| 자바스크립트 잘하기 (0) | 2014.02.26 |
| Learning Advanced JavaScript (0) | 2014.02.26 |
| 자바스크립트 정규 표현식! (0) | 2013.12.19 |
| javascript Cookie - 쿠키 객체 (0) | 2013.05.29 |
댓글