JSFiddle - React, Tailwind, and code Playground

by Sean Wessell

JavaScript

var scores = [60, 50, 58, 54, 54, 58, 50, 52, 54, 48, 69, 34, 55, 51, 52, 44, 51, 69, 64, 66, 55, 52, 44, 18, 41, 53, 55, 61, 51, 44];

//clone array keeping original as scores, sort the new cloned array, grab the max value
var highscore = scores.slice(0).sort()[scores.length - 1];
var highscoreSolutions = [];

//find occurances of highscore and push to array
for (i = scores.length - 1; i > 0; i--) {
    if (scores[i] == highscore) {
        highscoreSolutions.push(i)
    };
}

alert('highscore: ' + highscore + '\nindexes: ' + highscoreSolutions)