Exercise Set 5

Exercise 1 of 6

Make a variable called raining, and set it to false. Read the Boolean page.

HTML

<button id="showRainingMessageButton">Show message</button>
<p id="rainingMessageParagraph"></p>

JavaScript

var showRainingMessageButton = document.getElementById("showRainingMessageButton");
var rainingMessageParagraph = document.getElementById("rainingMessageParagraph");

// your code will appear here

showRainingMessageButton.addEventListener("click", showRainingMessage);

function showRainingMessage() {
    if (raining == false) {
        rainingMessageParagraph.innerHTML = "Leave the umbrella";
    }
}

You must be signed in to type your code.

Last topic Next exercise