diff --git a/index.js b/index.js index f016ec9..ec77a49 100644 --- a/index.js +++ b/index.js @@ -57,7 +57,7 @@ if (data.length > 0) { let tableBody = document.getElementById('table-body'); tableBody.innerHTML = ''; - data.forEach((row, index) => { + data.sort((a, b) => b.votes - a.votes).forEach((row, index) => { let rowElement = tableBody.insertRow(); rowElement.setAttribute('class', `with-state-links row-${index} svelte-woitu6 first-poll-close-row`); let nameCell = rowElement.insertCell();