title: Move object from one array to another
body: <p>i have one object that one of the properties is an array of objects, the idea is to move objects from that array to no new one if one condition is true.</p>
  
  <pre><code>public $onInit(): void {
    this.getTicket();
  }
  
  public ticket: any; // Object with the array
  public comments: any = []; // New array to move the elements
  public getTicket(): void {
      this.ticketService
          .getTicketComplete(this.$stateParams.ticketID)
          .then((response: any) =&gt; {
              this.ticket = response;
              this.stringToDate(this.ticket);
              this.ticket.messages.forEach((elem, index) =&gt; {
                  if (elem.type === "comment") {
                      this.ticket.messages.splice(index, 1);
                      this.comments.push(elem);
                  }
              });
              console.log(this.ticket);
      });
  }
  </code></pre>
  
  <p>the problem that i have is the next one:
  the array has to types of objects, messages and comments, if the array has 2 messages and 3 comments it should push to the new array 3 comments and leave 2 messages, but is moving only 2 comments.</p>
  
  <p>Any idea. Thanks for your help.</p>