Update index.js

This commit is contained in:
zongor 2024-11-05 11:38:55 -05:00
parent 869c43b17a
commit dc456207b7
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@
candidateInfo.innerHTML = '<h3>Candidates:</h3>'; candidateInfo.innerHTML = '<h3>Candidates:</h3>';
const candidatesList = document.createElement('ul'); 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'); const listItem = document.createElement('li');
listItem.innerHTML = ` listItem.innerHTML = `
<span>${candidate.name[0]}</span> (${candidate.name[1]}) - ${candidate.votes} votes <span>${candidate.name[0]}</span> (${candidate.name[1]}) - ${candidate.votes} votes