Data Visualization · Exercise 1 of 5Next
Beginner
A change that never says Infinity
The helper changeText(now, before) prints Infinity% or NaN% when there is nothing to compare with.
Make it return no earlier value when before is 0, missing or not a number, and keep up 20.0% / down 10.0% for normal cases.
What Check tests
- A rise reads up 20.0%
- A fall reads down 10.0%
- A zero before says no earlier value
- A missing before says no earlier value
- No line prints Infinity or NaN
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.