forked from ReDI-School/js-2025-fall
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
65 lines (56 loc) · 2.27 KB
/
index.html
File metadata and controls
65 lines (56 loc) · 2.27 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
<!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>
<h1>Right click and choose "view page source". Finish the exercises</h1>
<script>
/*
You work as a developer at an online bookstore.
The sales team sent you some data regarding the sales of the last 4 months and you have to prepare a report for the web.
Instructions:
- all the variables provided are set to 0, so in order to check that your code works you have to change them to different values
- if you think you need additional variables, feel free to create them
- some variables must be used in more than one exercise
- every exercise mentions if...else statement, but in some cases you might need to use also the "else if"
*/
let sales = 0;
/*
Exercise 1:
You want to check that the total sales are within a certain range.
- complete the if...else statement so that the result is true if sales are greater than or equal to 70 and less than or equal to 99
*/
if () {
console.log("Sales are: " + sales + ". Are they between 70 and 99?", true);
} else {
console.log("Sales are: " + sales + ". Are they between 70 and 99?", false);
}
/*
Exercise 2:
You receive a report with the sales from the Sci-fi department and the Crime department.
You want to check that the sales of at least one of the two departments are within a certain range, otherwise it's bad news for the store
- write an if...else statement that outputs true if at least one of the 2 sales amount is in the range between 200 and 500, false otherwise
- test with different values
*/
let sciFiDepartmentSales = 0;
let crimeDepartmentSales = 0;
if () {
console.log(true);
} else {
console.log(false);
}
/*
Exercise 3:
You also receive the report from the Comic Book department.
Using also the variables from Exercise 2, check that at least one of the three departments sold enough.
- write an if...else statement that outputs true if at least one of the 3 sales amount is in the range between 200 and 500, false otherwise
- test with different values
*/
let comicBookDepartmentSales = 0;
</script>
</body>
</html>