Exercise Set 5

Exercise 1 of 6

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


<button id="showMessageButton">Show message</button>
<p id="messageParagraph"></p>


var showMessageButton = document.getElementById("showMessageButton");
var messageParagraph = document.getElementById("messageParagraph");

// your code will appear here

showMessageButton.addEventListener("click", showMessage);

function showMessage() {
    if (raining == false) {
        messageParagraph.innerHTML = "Leave the umbrella";

You must be signed in to type your code.

Last topic Next exercise