const todos = [{ text: 'Order Cat food', completed: true }, { text: 'Clean kitchen', completed: true }, { text: 'Buy food', completed: false }, { text: 'Do work', completed: false }, { text: 'Exercise', completed: false }] // 1. Convert array to array of objects -> text, completed // 2. Create function to remove a todo by text value const deleteTodo = function (todos, todoText) { const index = todos.findIndex(function(array) { if (array.text.toLowerCase() === todoText.toLowerCase()){ console.log(`found!`) } console.log(`not found!`) return array.text.toLowerCase() === todoText.toLowerCase() }) // console.log(index) if (index > -1) { todos.splice(index, 1) console.log(`deleted index at ${index}`) } } // returns only the items that are set to completed: false const getThingsToDo = function (todos) { return todos.filter(function (todo, index) { return !todo.completed }) } console.log(getThingsToDo(todos)) deleteTodo(todos, 'buy food') console.log(todos)