-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
60 lines (48 loc) · 1.4 KB
/
app.js
File metadata and controls
60 lines (48 loc) · 1.4 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
console.log("howdy")
let secretCode = '🍕🍕🍱🍳🍢'
let string = ''
let inputElement = document.getElementById("user-input")
let secretImgElement = document.getElementById("secret-img")
console.log('inputElement', inputElement)
// console.warn(secreteCode == string)
function clickPizza() {
string += '🍕'
console.log('☝️🍕')
drawUserInputString()
}
function clickBento() {
string += '🍱'
console.log('☝️🍱')
drawUserInputString()
}
// NOTE foodItem is a parameter. A Block Scoped variable to this function that has no value
// foodItem doesn't have a value until it's called
// onclick="clickFoodButton('🫔')" : foodItem = '🫔'
function clickFoodButton(foodItem) {
string += foodItem
console.log('☝️', foodItem)
drawUserInputString()
}
function checkCode() {
console.warn(secretCode == string)
// the comparison creates a BOOL for the if to check
// True runs the block
// False skips the block
if (secretCode == string) {
console.log("It's TRUE")
secretImgElement.classList.remove('d-none')
// secretImgElement.classList.add('d-none')
} else {
console.log("Else False")
string = ''
drawUserInputString()
}
// ! is NOT, so these are NOT equal
// if (secreteCode !== string) {
// console.log("It's FALSE")
// }
}
function drawUserInputString() {
console.log("current user string", string)
inputElement.innerText = string
}