Posted By

noah on 07/06/07


Tagged

javascript hack library standards oo tools utilities douglascrockford inheritance architecture DRY


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

ctran
hans


Crockford's object producer


 / Published in: JavaScript
 

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

Note that this will /not/ work: var a = {a:1, b:2} var b = {prototype: a}

  1. function object(o) {
  2. function F() {}
  3. F.prototype = o;
  4. return new F();
  5. }

Report this snippet  

You need to login to post a comment.