title: Copying an array of objects into another array in javascript (Deep Copy)
body: <p>Copying an array of objects into another array in javascript using slice(0) and concat() doesnt work.</p>
  
  <p>I have tried the following to test if i get the expected behaviour of deep copy using this. But the original array is also getting modified after i make changes in the copied array.</p>
  
  <pre><code>var tags = [];
  for(var i=0; i&lt;3; i++) {
      tags.push({
          sortOrder: i,
          type: 'miss'
      })
  }
  for(var tag in tags) { 
      if(tags[tag].sortOrder == 1) {
          tags[tag].type = 'done'
      }
  }
  console.dir(tags)
  
  var copy = tags.slice(0)
  console.dir(copy)
  
  copy[0].type = 'test'
  console.dir(tags)
  
  var another = tags.concat()
  another[0].type = 'miss'
  console.dir(tags)
  </code></pre>
  
  <p>How can i do a deep copy of a array into another, so that the original array is not modified if i make a change in copy array.</p>