const newTodos = [
{
title: 'Buy Bread',
isDone: false,
},
{
title: 'Go to the Gym',
isDone: false,
},
{
title: 'Take a Shower',
isDone: false,
},
];
/*Find Method 1*/
const findTodo = function(myTodos: any, titleSearch: any) {
const titleReturned = myTodos.find(function(todo: any, index: any) {
return todo.title.toLowerCase() === titleSearch.toLowerCase();
});
return titleReturned;
};
/*Find Method 2*/
const findTodo = function(myTodos, titleSearch){
const indexReturned = object.indexOf(function(todo, index){
return todo.title.toLowerCase() === titleSearch.toLowerCase()
});
return indexReturned;
}