Exercise Set 10

Exercise 1 of 6

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


<button id="showMessageButton1">Show message</button>
<p id="messageParagraph1"></p>


var showMessageButton1 = document.getElementById("showMessageButton1");
var messageParagraph1 = document.getElementById("messageParagraph1");

var rich = true;
var famous = true;

showMessageButton1.addEventListener("click", showMessage1);

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

You must be signed in to type your code.

Last topic Next exercise