JavaScript Object Prototypal inheritance


/ Published in: JavaScript
Save to your folder(s)

an operator that implements true prototypal Object inheritance in JavaScript


Copy this code and paste it in your HTML
  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);

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

Report this snippet


Comments


You need to login to view comments.