-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
122 lines (107 loc) · 3.33 KB
/
Copy pathindex.js
File metadata and controls
122 lines (107 loc) · 3.33 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{
{
const nameA = 'Alpha'
const nameB = 'Beta'
const nameCompared = nameA == nameB
const nameComparedtwo = nameA === nameB
console.log(nameA)
console.log(nameB)
console.log(nameCompared)
}
{
const ageA = 18
const ageB = 25
if (ageA > ageB) {
console.log('Welcome to the club')
} else if (ageA < ageB) {
console.log('You are not old enough')
} else {
console.log('You both can enter')
}
}
{
const personA = {
name: 'Alpha',
age: 20
}
const personB = {
name: 'Betty',
age: 30
}
switch (personA.age > personB.age) {
case true:
console.log('Alpha is older than Betty')
break
case false:
console.log('Betty is older than Alpha')
break
default:
console.log('same age')
}
}
{
const personC = {
name: 'Darren',
age: 60
}
const personD = {
name: 'Chris',
age: 50
}
}
{
let age = prompt(`how old are you?`)
switch (age) {
case "1":
console.log('Same Age')
break
default:
console.log('Older than 1')
}
}
{
first_input = prompt("Input Number 1");
second_input = prompt("Input Number 2");
third_input = prompt("Input Number 3");
var final_score;
var addition = parseInt(first_input) + parseInt(second_input) + parseInt(third_input)
var average = addition / 3
var course_round = Math.round(average);
if (average > 90) {
final_score = "A";
}
else if (average > 80) {
final_score = "B";
}
else if (average > 71) {
final_score = "C";
}
else if (average > 65) {
final_score = "D";
}
else
final_score = "F";
switch (final_score) {
case "A":
window.alert("Great job, keep it up!");
break;
case "B":
window.alert("very nice work!");
break;
case "C":
window.alert("You can do it, keep studying");
break;
case "D":
window.alert("You some need help, see the teacher");
break;
case "F":
window.alert("Please schedule an appointment with your advisor");
}
document.write("Your three exams scores are: ");
document.write("Exam 1: " + first_input + " ");
document.write("Exam 2: " + second_input + " ");
document.write("Exam 3: " + third_input + " ");
document.write("Average: " + average + " ");
document.write("Course_grade " + final_score);
}
}