Try this exercise. Click the correct answer from the options.
From the JavaScript below, what will the console output be?
JAVASCRIPT
1const numbers = [4, 60, 53, 26, 2]
2
3let maximum = -Infinity
4let minimum = Infinity
5
6for(let number of numbers){
7 if(number > maximum)
8 maximum = number
9
10 if(number < minimum)
11 minimum = number
12 }
13
14console.log(`Maximum Value: ${getMaxOfArray(numbers)}` + `\nMinimum Value: ${getMinOfArray(numbers)}`);
Click the option that best answers the question.
- Maximum Value: 60, Minimum Value: 2
- Maximum Value: 53, Minimum Value: 4
- Maximum Value: 26, Minimum Value: ∞
- Maximum Value: -∞, Minimum Value: 2