Exercise Set 10

Exercise 1 of 6

Write a condition to match the message. Watch the logical operators video.


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


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

var rich = true;
var famous = true;

showMessageButton.addEventListener("click", showMessage);

function showMessage() {
    if (// your code will appear here) {
        messageParagraph.innerHTML = "I am rich and famous";

You must be signed in to type your code.

Last topic Next exercise