title: Javascript pushing objects into array changes entire array
body: <p>I'm using a specific game making framework but I think the question applies to javascript</p>
  
  <p>I was trying to make a narration script so the player can see "The orc hits you." at the bottom of his screen.  I wanted to show the last 4 messages at one time and possibly allow the player to look back to see 30-50 messages in a log if they want.  To do this I set up and object and an array to push the objects into.</p>
  
  <p>So I set up some variables like this initially...</p>
  
  <pre><code>servermessage: {"color1":"yellow", "color2":"white", "message1":"", "message2":""},
  servermessagelist: new Array(),
  </code></pre>
  
  <p>and when I use this command (below) multiple times with different data called by an event by manipulating servermessage.color1 ... .message1 etc...</p>
  
  <pre><code>servermessagelist.push(servermessage)
  </code></pre>
  
  <p>it overwrites the entire array with copies of that data... any idea why or what I can do about it.</p>
  
  <p>So if I push color1 "RED" and message1 "Rover".. the data is correct then if I push
  color1"yellow" and message1 "Bus" the data is two copies of .color1:"yellow" .message1:"Bus"</p>