Javascript Function - Find max number in an array

Veröffentlicht am: 09 November 2020
auf dem Kanal: Kathryn Sherazi
282
5

This function passes in an array and returns the max or highest number of that array. I have provided two different examples of how this can be accomplished.

For the first example, we are returning the largest number. This is done by comparing the first number of the array to every other number in the array by using a for loop and if statement. As the for loop "loops" through the array, if the current number is greater than the largest number (first number of the array), then the current number equals the largest number, and the max is returned.

The second option uses the Math.max method, which accomplishes the same task.

Read more about Math.max:
https://developer.mozilla.org/en-US/d...

For the production of this video, I used Visual Code with the Quokka extension, Screencastify, and music from Adobe Stock (Song: Toss the Salt)

For more coding news, job search recommendations, and everyday chatter, follow me on Twitter @KSherazi2


Auf dieser Seite können Sie das Online-Video Javascript Function - Find max number in an array mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Kathryn Sherazi 09 November 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 282 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!