Build a todo list with arrays:
let todos = []
function addTodo(text) {
todos.push({ id: Date.now(), text, done: false })
}
function toggleTodo(id) {
let todo = todos.find(t => t.id === id)
if (todo) todo.done = !todo.done
}
function removeTodo(id) {
let index = todos.findIndex(t => t.id === id)
if (index !== -1) todos.splice(index, 1)
}
function getPending() {
return todos.filter(t => !t.done)
}