Update index.js
This commit is contained in:
parent
869c43b17a
commit
dc456207b7
2
index.js
2
index.js
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue