michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Multiple Variables should Referring to a Single Object michael@0: * michael@0: * @path ch08/8.7/S8.7_A1.js michael@0: * @description Create object and refers to the other object, modify a property in the original object. michael@0: * We now see that that change is represented in both variables michael@0: */ michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK# michael@0: // Set obj to an empty object michael@0: // michael@0: var obj = new Object(); michael@0: // objRef now refers to the other object michael@0: // michael@0: var objRef = obj; michael@0: // Modify a property in the original object michael@0: objRef.oneProperty = -1; michael@0: obj.oneProperty = true; michael@0: // We now see that that change is represented in both variables michael@0: // (Since they both refer to the same object) michael@0: if(objRef.oneProperty !== true){ michael@0: $ERROR('#1: var obj = new Object(); var objRef = obj; objRef.oneProperty = -1; obj.oneProperty = true; objRef.oneProperty === true. Actual: ' + (objRef.oneProperty)); michael@0: }; michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: