Skip to content
Advertisement

Swapping the largest item in an array with the first position item

I need to find the largest number in array bb and swap it with the first item. I was able to find the largest number and move it to the front, but I can’t get the item in the first position to swap. Any help would be greatly appreciated!

JavaScript

Advertisement

Answer

you have to keep the position and the value of the largest number.

When you have it :

JavaScript

Hope help you

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement