let c = await api.getVotes('') // returns bot info   const myObject = {} for(const item of c) { if(!myObject[item.id]) { myObject[item.id] = 1; } else { myObject[item.id]++ } }  let noice = Object.entries(myObject) let hi = noice.sort((a, b) => b[1] - a[1]); console.log(hi)   //your code for (const a[1] in hi) { //pretty sure here a[1] is wrong message += `${index + 1}) ${userVotes[index][0]}\t\t${userVotes[index][1]}` }  channelId.send(message)