How to get the index value of the largest three numbers in an array

var arr = [6,8,2,4,9,0];

for example, what is the index value of the largest three numbers in the array above? is there a good way

Mar.24,2021

this article sums up well you can take a look at


I wonder if you consider duplicate data. What if you do? For a simple implementation, assume that there is no repetition in the array, make a copy, sort it, find the three largest values, and then compare it with the original array. There is another way: Math.max finds the maximum, finds his index assumption I, and assigns the value of index I to be less than the minimum. Loop this operation three times.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e58917-44a06.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e58917-44a06.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?