-
Notifications
You must be signed in to change notification settings - Fork 0
/
calc.html
71 lines (59 loc) · 1.9 KB
/
calc.html
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
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
/*
let hour = 7;
let name = 'Anthony';
if (hour >= 6 && hour < 12 ) {
console.log (`Good morning, ${name}!`)
} else if (hour >= 13 && hour < 17) {
console.log (`Good afternoon, ${name}!`)
} else console.log (`Good night, ${name}!`)
*/
/*
let age = 6
const isHoliday = true
if (age <= 5 || age >= 50 && (isHoliday = false)) {
console.log(' You are almost there!')
} else if (age <=6 || age >= 65 && (isHoliday = true)) {
console.log('You are qualified for a discount')
} else console.log('No discount')
*/
const randomNumber = Math.random()
let result = '';
let guess = 'heads' || 'tails' ;
if (randomNumber >= 0 && randomNumer < 0.5) {
console.log = ('head');
} else if (randomNumber >= 0.5 && randomNumber < 1)
result = 'tail'
/*
if (guess === result)
console.log('You win')
else console.log ('You lose')
*/
/*
let result = '';
if (computerMove === 'rock') {
result = 'tie';
}else if (computerMove === 'paper'){
result = 'You lose';
} else if (computerMove === 'scissors'){
result = 'You win';
}
let computerMove = '';
if (randomNumber >= 0 && randomNumber < 1 / 3){
computerMove = 'rock';
} else if (randomNumber >= 1 / 3 && randomNumber < 2 / 3){
computerMove ='paper';
} else if(randomNumber >- 2 / 3 && randomNumber < 1){
computerMove ='scissors';
</script>
</body>
</html>