Advanced
Timed: a sparkline that survives odd data (5 minutes)
Interview-style task, about 5 minutes. Finish spark(values), which draws into #spark (an SVG 120 by 24) and is available as window.spark.
Normal data: one <path> through every finite value and an end dot. No data (an empty list): no marks and #note says No data. One value: a dot and no path. Values that are null or NaN are skipped. The SVG must never hold NaN.
What Check tests
- Four values draw a path with four points and a dot
- An empty list draws nothing and says No data
- One value draws a dot and no path
- null and NaN are skipped
- Flat data stays clean
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.