Data Visualization · Exercise 1 of 4Next
Beginner
Show the nearest day
Five days are drawn as dots. #out should name the dot closest to the pointer, but it names the next dot as soon as the pointer passes the previous one.
Fix the search so the pointer always shows the closest dot, including past the last one.
What Check tests
- A pointer just right of dot 2 shows Day 2
- A pointer just left of dot 4 shows Day 4
- A pointer past the last dot still shows Day 5
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.