From 869c43b17a815a63e733f09cc37de8ca2aa5575f Mon Sep 17 00:00:00 2001 From: zongor <admin@alfrescocavern.com> Date: Tue, 5 Nov 2024 11:34:50 -0500 Subject: [PATCH] add sorting --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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();