title: Strange behavior when assigning the values of an object to another object
body: <p>First let me apologize for my poor english and javascript skills, I am a beginner.</p>
  <p>Here is my problem: I would like to copy the key and values of a source object (words.wordFailed[ tmp ]) into a target object (words.wordsFailedOnly[ counter ]):</p>
  <pre><code>words.wordsFailedOnly[ counter ] = words.wordsFailed[ tmp ];
  </code></pre>
  <p>Once this is done I add a new key/value pair to the target:</p>
  <pre><code>words.wordsFailedOnly[ counter ][ 'newKey' ]  = tmp;
  </code></pre>
  <p>Even though I don't assign the new key to the source object, after the first foreach loop has been executed, I noticed that the source object has also this new key &quot;newKey&quot;.</p>
  <p>Here is the complete code portion:</p>
  <pre><code>                settings.languages.forEach( function( lang ) { 
  
                      let counter = 0;
  
                      Object.keys( words.wordsFailed ).forEach( function ( tmp ) {
  
                          if ( words.wordsFailed[ tmp ][ lang ] &gt; 0 ) {
  
                              counter++;
                              
                              words.wordsFailedOnly[ counter ] = words.wordsFailed[ tmp ];
                              words.wordsFailedOnly[ counter ][ 'newKey' ] = tmp;
  
                          }
  
                      });
  
                  });
  </code></pre>
  <p>In other words, with <code>console.log(words.wordsFailed)</code> I notice that both objects have been assigned the &quot;newKey&quot; key. This is a very add behavior, in my code I just create newKey for the target, at no moment I have told to add this key to the source object. I just can't understand what is going on. How can I avoid this behavior ? I need the newKey only in the target object.</p>
  <p>Can someone help please if you have an idea?</p>
  <p>EDIT for additional information:</p>
  <p>Example of what the source target contains:</p>
  <pre><code>{deu: 3, id: 16, eng: 3}
  </code></pre>
  <p>Example of what the target contains after it has gone through the foreach loop (this is the expected result):</p>
  <pre><code>{deu: 3, id: 16, eng: 3, newKey: 10}
  </code></pre>
  <p>On the second foreach loop the source also contains the &quot;newKey&quot; key (this is not what I expected. I don't expect the source to have the &quot;newKey&quot; key):</p>
  <pre><code>{deu: 3, id: 16, eng: 3, newKey: 10}
  </code></pre>
  <p>Expected result for target:</p>
  <pre><code>{deu: 3, id: 16, eng: 3, newKey: 10}
  </code></pre>
  <p>Expected result for the source:</p>
  <pre><code>{deu: 3, id: 16, eng: 3}
  </code></pre>