1
0
CompleteNodeJS/playground/3-arrow-function.js
Jason Williams 63e639fab3 Video 22
2019-08-11 13:48:07 -06:00

25 lines
556 B
JavaScript

//
// Goal: Create method to get incomplete tasks
//
// 1. Define getTasksToDo method
// 2. Use filter to to return just the incompleted tasks (arrow function)
// 3. Test your work by running the script
const tasks = {
tasks: [{
text: 'Grocery shopping',
completed: true
},{
text: 'Clean yard',
completed: false
}, {
text: 'Film course',
completed: false
}],
getTasksToDo() {
return this.tasks.filter((task) => task.completed === false);
}
}
console.log(tasks.getTasksToDo())