title: How to fix the output 'undefined' when searching an array in Javascript
body: <p>I was trying to make a javascript code that searches inside an objects array for text and then deletes the whole index (the index that includes the text property) but the code failed and always return 'undefined' so i wanted to get some help.</p>
  
  <pre><code>const todos = [{
      text: 'wake up',
      completed: true
  }, {
      text: 'get some food',
      completed: false
  }, {
      text: 'play csgo',
      completed: false
  }, {
      text: 'play minecraft',
      completed: true
  }, {
      text: 'learn javascript',
      completed: false
  }]
  
  
  
  let todo = function (todo, todoText) {
      return todo.find(function (text, index) {
          if (todo.text.toLowerCase() === todoText.toLowerCase()) {
              todo.splice(index, 1);
          }
      })
  }
  
  let deleteTodo = todo(todos, 'wake up');
  console.log(deleteTodo);
  </code></pre>
  
  <p>i was expecting this output:</p>
  
  <pre><code>[{
      text: 'get some food',
      completed: false
  }, {
      text: 'play csgo',
      completed: false
  }, {
      text: 'play minecraft',
      completed: true
  }, {
      text: 'learn javascript',
      completed: false
  }]
  </code></pre>
  
  <p>but the output was actually <code>'undefined'</code></p>