@Code Challenge No luck, here. I'm gonna have to buy a new generator, so it's time to go shopping! You know what they say... "First is the worst, second is the best". I think I'll buy the second most expensive generator.
Here is your challenge: Write a function such that, when given an unsorted array of numbers, the function returns the second highest number.
secondLargest([10, 40, 30, 20, 50])
should return40
.secondLargest([25, 143, 89, 13, 105])
should return105
.secondLargest([54, 23, 11, 17, 10])
should return23
.
You may use any language you'd like to solve this challenge. Hopefully I can afford the generator you pick...