Skip to content

Instantly share code, notes, and snippets.

@anmolsukki
Last active May 3, 2020 23:02
Show Gist options
  • Save anmolsukki/af74ca1d0f73f96ff0b44afbee4c8d11 to your computer and use it in GitHub Desktop.
Save anmolsukki/af74ca1d0f73f96ff0b44afbee4c8d11 to your computer and use it in GitHub Desktop.
[ Javascript ] arrow function refactor filter challenge (https://repl.it/@anmolsukki/refactorArrowFunction)
const tasks = {
task: [{
text: 'Grocery shopping',
completed: true
},{
text: 'Clean yard',
completed: true
}, {
text: 'Film course',
completed: false
}],
getTasksToDo(){
return this.task.filter((task) => task.completed === true )
}
}
console.log(tasks.getTasksToDo()) // [{ text: 'Grocery shopping', completed: true }, { text: 'Clean yard', completed: true }]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment