Created
August 10, 2020 19:47
-
-
Save hyber1z0r/fae9047659b6a2372d0242dadce17945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Todo = { | |
id: number; | |
title: string; | |
completed: boolean; | |
} | |
const todos: Todo[] = [ | |
{ id: 1, title: 'Buy nachos', completed: false }, | |
{ id: 2, title: 'Buy avocado', completed: true }, | |
{ id: 3, title: 'Buy ground beef', completed: false }, | |
]; | |
const completedTodos = todos.filter((todo) => todo.completed); | |
console.log(completedTodos); // [{ id: 2, title: 'Buy avocado', completed: true }] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment