Mark As Completed Discussion

One Pager Cheat Sheet

  • You can find the maximum and minimum value of an array using JavaScript by creating it and accessing its elements.
  • The index of the array determines its minimum value, which in this case is 2, the smallest number of the entire array.
  • We set the minimum variable to Infinity and the maximum variable to -Infinity to compare values correctly.
  • Yes, Infinity is greater than 5,000,000 because it is an unbounded number that is higher than any assignable quantity.
  • Using a For Loop, a comparison of the values inside the array is conducted to find the maximum and minimum values and output them to the console.
  • Utilizing Javascript's built-in functions, Math.min and Math.max, we can create our own functions to find the minimum and maximum of an array.
  • The for loop iterates through the array and stores the largest and smallest numbers in the maximum and minimum variables which are outputted as "Max Value: 60" and "Min Value: 2".
  • The code uses a for loop to compare each number in the array and updates the values of minimum and maximum according to the result, then uses getMaxOfArray and getMinOfArray functions to return the maximum and minimum values.