Data Visualization · Exercise 4 of 4 Previous
Advanced
Read a date range from the URL
Write parseRange(hash). It gets text such as #from=2025-06-01&to=2025-06-30 and returns ["2025-06-01", "2025-06-30"].
Anything unusable must give null, never an error: a missing part, text that is not a date, a date that does not exist (2025-02-30), or an empty range. A reversed range is swapped.
What Check tests
- A good range comes back as two dates
- A reversed range is swapped
- Missing or unreadable parts give null
- A date that does not exist gives null
- An empty range gives null
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.