topical media & game development

talk show tell print

#javascript-code-21-constructor.js / js



  // Create a new, simple, User object
  function User() {}
  
  // Create a new User object
  var me = new User();
  
  // Also creates a new User object (from the
  // constructor reference of  the first)
  var you = new me.constructor();
  
  // We can see that the constructors are, in fact, the same
  alert( me.constructor == you.constructor );
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.