Sikau

JavaScript · Day 59 · about 40 min

Capstone: build

Build it step by step.

Build day

Today you build the habit tracker's core: add habits, show them, and tick them off for today. You'll use objects, arrays, DOM, events and the data → render pattern.

Today's date as a key

Each habit stores the days it was done as strings like "2026-10-08". A helper gives today's date in that format:

const today = () => new Date().toISOString().slice(0, 10);
console.log(today());

const habit = { name: "Walk", days: [] };
habit.days.push(today());
console.log(habit.days.includes(today()));

The rest of this lesson

  • Build in thin slicesexplain
  • Dates as keysexplain
  • Toggle a daypredict
  • Slicesorder
  • Build the trackerchallenge
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 68 lessons of JavaScript