Posted By

luizlopes on 11/17/11


Tagged

javascript object prototype inheritance prototypal


Versions (?)

JavaScript Object Prototypal inheritance


 / Published in: JavaScript
 

URL: http://javascript.crockford.com/prototypal.html

an operator that implements true prototypal Object inheritance in JavaScript

  1. if (typeof Object.create !== 'function') {
  2. Object.create = function (o) {
  3. function F() {}
  4. F.prototype = o;
  5. return new F();
  6. };
  7. }
  8. newObject = Object.create(oldObject);

Report this snippet  

You need to login to post a comment.