-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif-statements.js
More file actions
54 lines (43 loc) · 1.03 KB
/
if-statements.js
File metadata and controls
54 lines (43 loc) · 1.03 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
/*
let animal = 'cat' //global scope
animal = 'Dog'
animal = 'snake'
if (animal === 'dog' || animal === 'Dog' || animal === 'snake') {
animal = 'snake' //block scope
console.log('woof', animal)
} else{
console.log('Your animal is', animal)
}
let person = 'mammal'
person = 'not mammal'
person = false || 'test'
person = false || null || undefined
console.log('person before if:', person)
if (person === 'Mammal') {
console.log('yes though so!')
} else if(person && true){
console.log('not sure')
} else if(person === 'not mammal'){
console.log('this is catch all')
} else{
console.log('catch all')
}
*/
//DATE
const date = new Date()
console.log(date)
const time = date.getTime()
console.log(time)
const hours = date.getHours()
console.log(hours)
if (hours > 12){
console.log('Is past lunch time')
} else if(hours <= 11.50){
console.log('Is almost lunch time')
}
const today = date.getDate()
console.log(today)
if(today === 12) {
console.log('Happy July 12')
}
if(today === 12) console.log('Happy July 12')