toDoList 是一个数组,其中包含一些具有属性的对象
这个不行。它返回未定义。
const showToDo = toDoList.filter((todo)=>todo.isDone === true);
const showToDoTitle = showToDo.forEach(todo=>todo.title);
console.log(showToDoTitle);
这个有效
const showToDo = toDoList.filter((todo)=>todo.isDone === true);
showToDoTitle = showToDo.forEach(todo=>console.log(todo.title));