-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
37 lines (31 loc) · 851 Bytes
/
script.js
File metadata and controls
37 lines (31 loc) · 851 Bytes
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
function getRandomDegree(min, max) {
return (max - Math.random() * (max - min));
}
function springDegrees() {
return getRandomDegree(10, 24);
}
function summerDegrees() {
return getRandomDegree(20, 40);
}
function autumnDegrees() {
return getRandomDegree(5, 16);
}
function winterDegrees() {
return getRandomDegree(-5, 10);
}
function getSeasonalDegrees(season) {
switch (season) {
case 'spring':
return springDegrees();
case 'summer':
return summerDegrees();
case 'autumn':
return autumnDegrees();
case 'winter':
return winterDegrees();
default:
return 'Season not recognized.';
}
}
const currentSeason = 'spring';
console.log(`The degrees for ${currentSeason} is: ${getSeasonalDegrees(currentSeason)}C°`);