

JS Sky Classifier
Write a function classifySky(visibility, isStormy, isNight) that takes visibility (number in miles), isStormy (boolean), and isNight (boolean). It should return the sky status as a string:
- If it is stormy, return 'unsafe'.
- Otherwise, if visibility is strictly less than 3 miles, or if it is night and visibility is strictly less than 5 miles, return 'restricted'.
- In all other cases, return 'clear'.
Examples
classifySky(10, true, false)
→ "unsafe"
classifySky(2, false, false)
→ "restricted"
solution.js
JAVASCRIPT
Saved as you type
Tests
0 of 5 passing- •stormy check: (10, true, false) → unsafeclassifySky(10, true, false)expected "unsafe"
- •low visibility: (2, false, false) → restrictedclassifySky(2, false, false)expected "restricted"
- •night visibility check: (4, false, true) → restrictedclassifySky(4, false, true)expected "restricted"
- •night visibility ok: (6, false, true) → clearclassifySky(6, false, true)expected "clear"
- •day visibility ok: (4, false, false) → clearclassifySky(4, false, false)expected "clear"
On the line
+40 XP
Pass all 5 tests to claim it.
