Code Lab

Too humid

EasyErrors3 min

A factory sensor measures humidity in percent. Write a function checkHumidity(percent). If the humidity is above 70, throw an Error with any message. If the humidity is fine, the function returns nothing.

Examples

checkHumidity(45)

Returns undefined

checkHumidity(70)

Returns undefined

70 is still fine.

Source

Loading the editor...
  1. InputcheckHumidity(80)
    ExpectedThrows Error
  2. InputcheckHumidity(45)
  3. InputcheckHumidity(70)

Hidden tests run on Submit.