Umbrella

Home

Part 1

Write a program to provide instructions based on whether or not it is raining out, and whether or not the user owns an umbrella. Model the concept of whether or not its raining in a variable called isRaining, assign it a boolean value of choice, and log it to the console. Model the concept of whether or not the user owns an umbrella in a variable called ownsUmbrella, assign it a boolean value of choice, and log it to the console.

Write an "if" statement to provide instructions to the user depending on the values of these variables:


Part 2

Write a JavaScript function called advise that encapsulates the logic from Part 1. It should accept boolean parameter inputs called isRaining and ownsUmbrella, and return the corresponding message. It should not log anything to the console.

Invoke the function four different times using different combinations of boolean values for isRaining and ownsUmbrella, and log the resulting messages to the console to ensure the program works under all possible scenarios.


Part 3

See the check box inputs and "Advise" button below. Write JavaScript code to respond to button click events, and when the button is clicked, the program should determine the appropriate message (using the function from Part 2), and finally then display the resulting message in the designated span element.




TODO