topical media & game development

talk show tell print

#javascript-code-01-reference.js / js



  // Set obj to an empty object
  var obj = new Object();
  
  // objRef now refers to the other object
  var objRef = obj;
  
  // Modify a property in the original object
  obj.oneProperty = true;
  
  // We now see that that change is represented in both variables
  // (Since they both refer to the same object)
  alert( obj.oneProperty == objRef.oneProperty );
  


(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.