Build a JavaScript Todo App Tutorial – Step-by-Step Guide

Bobby Jul 13, 2026

Are you tired of forgetting tasks and deadlines? It's time to build a practical TODO app using JavaScript to keep track of all your tasks effortlessly. In this step-by-step tutorial, we'll guide you through creating a full-fledged TODO app from scratch, ensuring you learn essential JavaScript concepts along the way.

The 10 Best Beginner Projects for New Programmers
The 10 Best Beginner Projects for New Programmers

Before we dive in, make sure you have a basic understanding of HTML and CSS, and that you've set up your development environment with Node.js and a code editor like Visual Studio Code. Let's start by setting up our project and discussing the technologies we'll be using.

To-Do App Project using JavaScript ⚡
To-Do App Project using JavaScript ⚡

Project Setup and Technologies

First, create a new folder for your project and navigate into it:

Create A Todo List App in HTML CSS & JavaScript
Create A Todo List App in HTML CSS & JavaScript

mkdir todo-app && cd todo-app

Initialize a new npm project and install necessary dependencies:

npm init -y
npm install express ejs

Next, create the following folders and files inside your project folder:

how to create a to do list with jajascript in adobe and wordpress
how to create a to do list with jajascript in adobe and wordpress
  • views - contains our EJS ( Embedded JavaScript templates) files.
  • public - holds our static files like CSS and JavaScript.
  • app.js - the main application file where we'll write our JavaScript code.

Express Server Setup

Let's set up a basic Express server in app.js. We'll also configure it to serve our static files and EJS templates.

Best 40+ javascript projects for beginners With Source Code
Best 40+ javascript projects for beginners With Source Code

Here's a simple Express server setup:

const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;

app.set('view engine', 'ejs');
app.use(express.static('public'));
app.use(express.urlencoded({ extended: true }));

app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});

Creating the Homepage

Create an index.ejs file inside the views folder. We'll make this our homepage, displaying an input field and a submit button for adding new tasks.

How to Create Todo App with Next.js & Firebase
How to Create Todo App with Next.js & Firebase

In our app.js file, we'll also create a route for the homepage: /.

Building the TODO Functionality

JavaScript Project | Day 01
JavaScript Project | Day 01
To-do List widget design
To-do List widget design
JavaScript Projects ideas for All Developer
JavaScript Projects ideas for All Developer
Build A Todo list app in HTML, CSS and JavaScript - Part 3| JavaScript code #javascriptforbeginners
Build A Todo list app in HTML, CSS and JavaScript - Part 3| JavaScript code #javascriptforbeginners
React Todo List App Tutorial - Beginner React JS Project Using Hooks
React Todo List App Tutorial - Beginner React JS Project Using Hooks
10+ JavaScript To-Do List (latest collection)
10+ JavaScript To-Do List (latest collection)
To Do List with HTML, CSS & JS
To Do List with HTML, CSS & JS
How to create Todo List App using HTML CSS and JavaScript | Create Todo List using JavaScript.
How to create Todo List App using HTML CSS and JavaScript | Create Todo List using JavaScript.
The JavaScript Cheat Sheet Every Beginner Wishes They Had
The JavaScript Cheat Sheet Every Beginner Wishes They Had
Best JavaScript Projects for Beginners to Practice
Best JavaScript Projects for Beginners to Practice
JavaScript Cheatsheet for Beginners | Learn JS Fast (One-Page Guide)
JavaScript Cheatsheet for Beginners | Learn JS Fast (One-Page Guide)
Toggle Fullscreen in Javascript
Toggle Fullscreen in Javascript
How to Build a TodoApp using ReactJS and Firebase
How to Build a TodoApp using ReactJS and Firebase
Javascript scroll to top | Javascript tutorial
Javascript scroll to top | Javascript tutorial
To Do List In HTML Javascript
To Do List In HTML Javascript
Javascript window.confirm() method | Javascript tutorial
Javascript window.confirm() method | Javascript tutorial
Build a Weather App with JavaScript  | Beginner-Friendly Project
Build a Weather App with JavaScript | Beginner-Friendly Project
JavaScript calculator projet
JavaScript calculator projet
Create a Real time Todo App with React Native
Create a Real time Todo App with React Native
JavaScript Cheat Sheet 🚀 | Complete JS Reference for Beginners & Developers
JavaScript Cheat Sheet 🚀 | Complete JS Reference for Beginners & Developers

Now, let's add the core TODO functionality. We'll use an array to store our tasks, as we're not connecting to a database in this tutorial.

Adding New Tasks

When a user submits a new task, we'll add it to our tasks array and redirect them back to the homepage.

First, create an empty array named tasks in our app.js file. Then, add a new route to handle the post request when a user submits a task:

app.post('/add-task', (req, res) => {
  const newTask = req.body.task;
  tasks.push(newTask);
  res.redirect('/');
});

Displaying Existing Tasks

To display our existing tasks, we'll loop through the tasks array in our index.ejs file and display each task in an unordered list.

Here's how you can do that:

<% tasks.forEach(function(task) { %>
  
  • <%= task %>
  • <% }); %>

    Adding Interactivity with JavaScript

    Finally, let's add some interactivity to our app by allowing users to mark tasks as completed and delete them.

    Marking a Task as Completed

    To mark a task as completed, we'll add a checkbox input next to each task. When a user checks the box, we'll remove that task from our array.

    Here's how to implement this in our index.ejs file:

    <% tasks.forEach(function(task, index) { %>
      
  • <% }); %>

    In our public folder, create a new file named script.js and add the following JavaScript code to handle the task removal:

    function removeTask(index) {
      tasks.splice(index, 1);
      location.reload();
    }

    Deleting a Task

    To delete a task, we'll add a delete button next to each task. When a user clicks the button, we'll remove that task from our array.

    Here's how to implement this in our index.ejs file:

    <% tasks.forEach(function(task, index) { %>
      
  • <% }); %>

    Add the following JavaScript code to our script.js file to handle task deletion:

    function deleteTask(task) {
      const index = tasks.indexOf(task);
      if (index >= 0) {
        tasks.splice(index, 1);
        location.reload();
      }
    }

    You now have a fully functional TODO app! You can build upon this foundation to add more features like user authentication, task categorization, and more.

    Programming should be fun and rewarding. Experiment with this project, and don't hesitate to add your unique twists to make it your own. Happy coding!