From dc456207b709081701d419b11b4975e0b1d28911 Mon Sep 17 00:00:00 2001 From: zongor Date: Tue, 5 Nov 2024 11:38:55 -0500 Subject: [PATCH] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ec77a49..37a83a5 100644 --- a/index.js +++ b/index.js @@ -88,7 +88,7 @@ candidateInfo.innerHTML = '

Candidates:

'; const candidatesList = document.createElement('ul'); - row.candidates.forEach(candidate => { + row.candidates.sort((a, b) => b.votes - a.votes).forEach(candidate => { const listItem = document.createElement('li'); listItem.innerHTML = ` ${candidate.name[0]} (${candidate.name[1]}) - ${candidate.votes} votes