-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment 4
More file actions
39 lines (28 loc) · 764 Bytes
/
Copy pathAssignment 4
File metadata and controls
39 lines (28 loc) · 764 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
38
39
const x = 23;
if (x == 23) {
console.log("Hello world");
}
console.log(x + 10);
console.log(x + 10);
console.log(x + 10);
console.log(x + 10);
console.log(x + 100);
const temptatures = [3, -2, -6, -1, "error", 9, 13, 17, 15, 14, 9, 5];
const newTemp = [];
for (let i = 0; i <= temptatures.length - 1; i++) {
if (temptatures[i] !== "error") {
console.log(temptatures[i]);
newTemp.push(temptatures[i]);
}
}
console.log(newTemp);
const maxTemp = Math.max(...newTemp);
const minTemp = Math.min(...newTemp);
console.log(maxTemp);
console.log(minTemp);
console.log(`Teamprature Amplitutde is ${maxTemp - minTemp}`);
let tempAmp = [];
for (let i = 0; i <= newTemp.length - 1; i++) {
tempAmp.push(maxTemp - newTemp[i]);
}
console.log(tempAmp);