-
Notifications
You must be signed in to change notification settings - Fork 127
/
conditionals.js
26 lines (18 loc) · 1.17 KB
/
conditionals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
let button = document.querySelector(".button");
let californiaMessage = document.querySelector(".california");
let illinoisMessage = document.querySelector(".illinois");
let newyorkMessage = document.querySelector(".new-york");
let other = document.querySelector(".other");
button.addEventListener("click", function() {
let state = document.querySelector(".state").value;
// CODE ALONG
// 1. Write an if statement that would display the california message if a user says they're from "California".
// CODE SOLO
// 2. Write an else if statement that would display the illinois message if a user says they're from "Illinois".
// 3. Write an else if statement that would display the new york message if a user says they're from "New York".
// 4. Write an else statement that displays the other message if the user types in a different state.
});
// Finished early?
// - Add another state of your choosing!
// - See if you can update your statements to accept a user typing the state in different ways: all caps, all lowercase, and first letter capitalized.
// - This will be in our next lesson, but do some research and see if you can figure it out 💪