0

i can't find the problem. I am just getting "Uncaught TypeError: Cannot set property 'display' of undefined" this error.

function filterTodo(e){
const todos = todoList.childNodes;
todos.forEach(function(todo){
    switch (e.target.value){
        case "all" :
            todo.style.display = 'flex';
            break;

        case "completed" :
            if(todo.classList.contains('completed')){
                todo.style.display = 'flex';
            }
            break;
    }
});

}