Video 22
This commit is contained in:
24
playground/3-arrow-function.js
Normal file
24
playground/3-arrow-function.js
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// 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())
|
||||
Reference in New Issue
Block a user