Finding Second Largest Number From Array in JavaScript

While working on one of the client project, I just wrote a functions to find 1st and 2nd Largest Numbers in JavaScript. And I would like to share with you one of them which demonstrates how to find second largest number using javascript.

1 reply
  1. Himanshu Saraswat
    Himanshu Saraswat says:

    This wont work if all the values are less than zero. By default it assumes the lowest value as 0 and will return 0 if the array contains all the negative values


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *