function myObject() {
  this.value = 1;
  this.changeValue = function() {
    this.value = false;
  }
}

myObject.prototype.changeValue = function() {
  this.value = true;
}

var object1 = new myObject();
var object2 = object1;

function compareObjects() {
  var outputString = "object1.value = "+object1.value+"<br/>";

  object2.changeValue();
  outputString += "object1.value = "+object1.value+"<br/>";

  object2.value = 2;
  outputString += "object1.value = "+object1.value+"<br/>";

  document.getElementById("debug1").innerHTML = outputString;
}

////////////////////////////////////////////////////////////////////////////////
var variable1 = 1;
var variable2 = variable1;

function compareVariables() {
  var outputString = "variable1 = "+variable1+"<br/>";

  variable2 = "A text.";
  outputString += "variable1 = "+variable1+"<br/>";
  outputString += "variable2 = "+variable2+"<br/>";

  outputString += "Equals? "+(variable1 === variable2)+"<br/>";

  document.getElementById("debug2").innerHTML = outputString;
}

////////////////////////////////////////////////////////////////////////////////
function start() {
  compareVariables();
  compareObjects();
}



/*

var object1 = new myObject();
var object2 = object1;

function compareObjects() {
  var outputString = "object1.val = "+object1.val+"<br/>";

  object2.changeValue();
  outputString += "object1.val = "+object1.val+"<br/>";

  object1.val = "A text.";
  outputString += "object2.val = "+object2.val+"<br/>";

  outputString += "Equals? "+(object2.val === object1.val)+"<br/>";

  document.getElementById("debug1").innerHTML = outputString;
}

*/