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

1 Expert Approved Answer
Step: 1 Unlock

function Minimum numArray Assumes numArray is an array of ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1409-C-S-O-S(1156).docx

120 KBs Word File

Students Have Also Explored These Related Operating System Questions!