We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

noah on 07/06/07


Tagged

javascript hack library standards oo tools utilities douglascrockford inheritance architecture DRY


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

ctran


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.