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.
- Write an
ifstatement that checks if thetemperatureis greater thanthreshold. - If it is, use
console.log()to sound the alarm: "It's a hot day!" - If the temperature is safe (
thresholdor less), your code should remain silent.
01EXAMPLE 1
Input
temperature = 35Output
Logs: "It's a hot day!"Explanation: Since 35 > 30, the message is printed.
02EXAMPLE 2
Input
temperature = 25Output
No outputExplanation: Since 25 <= 30, the condition is false.
Constraints
- Use a single if statement.
- Message must match exactly, including punctuation.
Control FlowConditionalsFundamentals
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
temperature35
threshold30
Expected Output
It's a hot day!
Click RUN to test your solution