Question: Define a function named Minimum that is similar to the Average function from Figure 17.11, but that takes an array of numbers as input and
Define a function named Minimum that is similar to the Average function from Figure 17.11, but that takes an array of numbers as input and returns the smallest value from that array. For example, the call Minimum ([33, 12, 5, 17, 8]) should return 5. After inserting this function into your arrays.js page, modify your average.html page so that it displays the minimum input value along with the average.
[To find the minimum value in an array, your function should traverse the array and record the smallest value it encounters. Start by initializing a variable to the first value in the array. Then, compare each subsequent value in the array to the variable, updating the variable whenever a smaller value is found.]
Step by Step Solution
3.41 Rating (179 Votes )
There are 3 Steps involved in it
function Minimum numArray Assumes numArray is an array of ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
1409-C-S-O-S(1156).docx
120 KBs Word File
