title: How to loop through javascript object and copy values to new object
body: <p>I have a javascript object on a page that contains some info.  I need to loop through the object and copy it to another object.</p>
  
  <p>Here is my starting code</p>
  
  <pre><code>var p_tag = {};
  var new_tag = {};
  p_tag.abc='abc';
  p_tag.def='def';
  p_tag.ghi='ghi';
  
  for (var key in p_tag) {
     if (p_tag.hasOwnProperty(key)) {
     console.log(key + "'s favorite fruit is " + p_tag[key]);
     }
  }
  </code></pre>
  
  <p>I need to take the values from p_tag and copy them to new_tag as another object.</p>
  
  <p>I may not know what keys are available on each page so looking for something that can go through all available p_tags and copy them to new_tag.</p>
  
  <p>Thanks,</p>