The Heat Sensor

EasyAcc. 98.5%
+15 XP 5

Under the Volcano

The heat is rising! In this mission, you are building a thermal sensor. We only want to alert the village if the temperature reaches a critical threshold.

The if statement is your primary tool—it acts as a gatekeeper that only opens when the conditions are just right.

The Assignment

Your function receives parameters temperature and threshold.

  1. Write an if statement that checks if the temperature is greater than threshold.
  2. If it is, use console.log() to sound the alarm: "It's a hot day!"
  3. If the temperature is safe (threshold or less), your code should remain silent.

01EXAMPLE 1

Inputtemperature = 35
OutputLogs: "It's a hot day!"

Explanation: Since 35 > 30, the message is printed.

02EXAMPLE 2

Inputtemperature = 25
OutputNo output

Explanation: Since 25 <= 30, the condition is false.

Constraints

  • Use a single if statement.
  • Message must match exactly, including punctuation.
Control FlowConditionalsFundamentals
JavaScript
Loading...
3 Hidden

Input Arguments

temperature35
threshold30

Expected Output

It's a hot day!

Click RUN to test your solution