In the code below, I use "push" to fill and empty array. I need help to write the above code so that it comes out the same way, without using "push". I have been challenged to this by the book, "Head First JavaScript Programming". I have tried, but I am stumped.
let scores = [60, 50, 60, 58, 54, 54, 58, 50, 52, 54, 48, 69, 34, 55, 51, 52, 44, 51, 69,
64, 66, 55, 52, 61, 46, 31, 57, 52, 44, 18, 41, 53, 55, 61, 51, 44
]
var highScore = 0
var output
for (var i = 0; i < scores.length; i++) {
output = `Bubbles solution # ${i} score: ${scores[i]}<br>`
document.write(output)
if (scores[i] > highScore) {
highScore = scores[i]
}
}
let bestSolutions = []
for (var i = 0; i < scores.length; i++) {
if (scores[i] == highScore) {
bestSolutions.push([i])
}
}
document.write(`Bubbles Tests: ${scores.length}<br>`)
document.write(`Highest Bubble Score: ${highScore}<br>`)
document.write(`Solutions with highest score: #${bestSolutions[0]} and #${bestSolutions[1]}`)