title: How do I get the index of object in array using angular?
body: <p>I need to have the index of an object in array so I can delete this part of the array. I tried using this:</p>
  
  <pre><code>var index = this.urenRegistratie.indexOf(newDatum);
  </code></pre>
  
  <p>But it keeps returning -1 and I don't know why this is happening.</p>
  
  <p>this is the part of the code I have. it gets data out of a form in html and places that into my array, now I already have an if statement ready  ( exisitingDatum )  , my code needs to be in there. Can someone please help me out a bit?</p>
  
  <pre><code> store(newValue:number, newDatum, newAanwezig, newComment){
      const existingDatum = this.urenRegistratie.find(billable =&gt; {
        return billable.datum === newDatum;
        return
      });
  
      if (!existingDatum) {
          let billable = new BillableHours();
          billable.datum = newDatum;
          billable.hours = +newValue;
          billable.aanwezig = newAanwezig;
          billable.comment = newComment;
  
          if(billable.aanwezig == "Aanwezig" &amp;&amp; billable.hours !== 0 &amp;&amp; billable.datum !== null) {
            this.urenRegistratie.push(billable);
          }
      }
  
      if(existingDatum) {
  
      }
  
    }
  </code></pre>