Coding Challenge: Adding a Check
Learn to avoid errors in this challenge.
Problem statement
Suppose we’re working on the application from the last challenge. We want to extend it with an additional function called checkDecentHour
, which takes a number
and returns a left
with the way too early stringwhen the hour is before
8`. In our application function, we now want to check whether it’s way too early after checking whether the hour is valid. Instead of returning a default error message as we did earlier, we want to give back whatever error we had.
Try it yourself
Get hands-on with 1400+ tech skills courses.