The
temp
array contains air temperature data measured over a period of time. We want to display the minimal temperature, and to do so we write the following code:
temp.forEach(e => min = min > e ? e : min); console.log(min);
In the code, we use the variable sum
, which should be previously declared as follows:
let min = temp[0];
- It’s not necessary, as it will be declared automatically on first use.
let min = 0;
let min;
More Questions: JavaScript Essentials 1 – JSE1: Final Test
Please login or Register to submit your answer