title: Make function CRUD DeletebyID(id) Javascript by its number of id not by index
body: <p>Heloo, i am new in learning of javascript. Can you guys help me..
  Here's the detail:</p>
  <p>I have arrays:</p>
  <pre><code>let todos = [
      {id: 1, todo: &quot;learning javascript&quot;},
      {id: 2, todo: &quot;sleeping&quot;},
      {id: 3, todo: &quot;playing&quot;},
  ];
  </code></pre>
  <p>All i have to do, I want to remove an array object that have number of id:2 by its id (exactly id/number) which is by &quot;number&quot; of value of the object. NOT by index. I want to make CRUD function. But the function only have one parameter, which is ID :</p>
  <pre><code>DeleteByID(id) ---&gt; by its number id, not by index.
  </code></pre>
  <p>So, the result will become like this:</p>
  <pre><code>   let todos = [
          {id: 1, todo: &quot;learning javascript&quot;},
          {id: 3, todo: &quot;playing&quot;},
      ];
  </code></pre>
  <p>I've already tried my code below..</p>
  <pre><code>  function deleteByID(id) {
    for(var i in todos){
      if(todos[i].id == id){
        todos[i].splice(i, id);
        break;
      }
    }
  }
  
  
      console.log(&quot;Delete:&quot;, deleteByID(2));
  </code></pre>
  <p>I've tried my code, but it doesn't work. I've tried to googling, but I still dont have any clue for the solution. Please help me guys. Thanks</p>