title: Copy array by value is not working in foreach in Angular
body: <p>I am trying to copy array in element of array and manipulate as per my need.</p>
  <pre><code> this.question?.labels.forEach((element) =&gt; {
        element[&quot;options&quot;] = [...this.question?.options]; // I've tried json.stringify() as well but not worked
        element[&quot;options&quot;].forEach(e =&gt; {
          e.checked = this.question?.userAnswers.find(i =&gt; e.key === i.value &amp;&amp; element.key === i.key) ? true : false;
        });
      });
  </code></pre>
  <p>I've used <code>[...this.question?.options]</code> to get new copy of option every time. but it always saved last value of array in each element</p>
  <p><a href="https://stackblitz.com/edit/pass-array-by-value?file=src%2Fapp%2Fapp.component.ts" rel="nofollow noreferrer">https://stackblitz.com/edit/pass-array-by-value?file=src%2Fapp%2Fapp.component.ts</a></p>
  <p><a href="https://i.stack.imgur.com/B5ECr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B5ECr.png" alt="enter image description here" /></a></p>