Skip to main content
📲 JavaScript App Logic

What you're building

A TodoManager class that stores tasks and exposes the full create / read / update / delete surface. This is the foundation of almost every data-driven app ever written.

Requirements

  • add(text, priority) — add a task; priority is "low", "medium", or "high" (default "medium"). Return the new task object: { id, text, priority, done: false }.
  • complete(id) — mark the task done. Return true if found, false otherwise.
  • remove(id) — delete the task. Return true if removed, false if not found.
  • getAll() — return all tasks (any order).
  • getByPriority(priority) — return tasks matching that priority that are not yet done.
  • pendingCount() — return the number of tasks where done === false.

Stretch goals

  • Add an edit(id, text) method that updates the text of an existing task.
  • Add a sort() method that returns all tasks ordered high → medium → low.

What this proves

You understand CRUD, filtering with Array.filter, object mutation, and unique IDs — the exact skills every junior dev interview tests with a whiteboard problem.

⚡ 40 XP
solution.jsRuns in your browser
Loading editor…
Tests4 to pass
add returns task with correct shape
complete marks done and remove deletes
getByPriority excludes done tasks
pendingCount tracks incomplete tasks

Run your code to check these.