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;priorityis"low","medium", or"high"(default"medium"). Return the new task object:{ id, text, priority, done: false }.complete(id)— mark the task done. Returntrueif found,falseotherwise.remove(id)— delete the task. Returntrueif removed,falseif 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 wheredone === 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.