3 ways to find second largest number in array JavaScript

·

1 min read

The first method involves sorting whose time complexity is O(nlogn)

The second method involves two for loop whose time complexity is O(n)

The second method involves just one for loop whose time complexity is also O(n)