Todo List

Create a todo list application

BeginnerTopic: Mini Projects
Back

JavaScript Todo List Program

This program helps you to learn the fundamental structure and syntax of JavaScript programming.

Try This Code
class TodoList {
    constructor() {
        this.todos = [];
    }
    add(text) { this.todos.push({ id: Date.now(), text, done: false }); }
    remove(id) { this.todos = this.todos.filter(t => t.id !== id); }
    toggle(id) { const t = this.todos.find(t => t.id === id); if(t) t.done = !t.done; }
    getAll() { return this.todos; }
}
Output
// Todo list functionality

Understanding Todo List

Todo List manages tasks.

Note: To write and run JavaScript programs, you need to set up the local environment on your computer. Refer to the complete article Setting up JavaScript Development Environment. If you do not want to set up the local environment on your computer, you can also use online IDE to write and run your JavaScript programs.

Table of Contents