Hello guys i have a quick qzestion regarding a table im trying to populate, following daniels video about BSC programming (full course).
this is the error im getting when i click the button that should populate the table (leaderboard)
this is a part of the functions of the code
async function populate(){
const name = await Moralis.Web3API.account.getTokenBalances({chain: chainToQuery}).then(buildLeaderboardTable);
}
function buildLeaderboardTable(data){
document.getElementById("resultLeaderboard").innerHTML =
`<table class ="table table-dark table-striped" id="leaderboardTable">
</table>`;
const table = document.getElementById("leaderboardTable");
const rowHeader = `<thead>
<tr>
<th>Rank</th>
<th>Score</th>
<th>Username</th>
<th>Address</th>
<th>Last Seen</th>
</thead>`
table.innerHTML += rowHeader
for(let i = 0; i < data.length; i++){
let row =
`<tr>
<td>${data[i].name}</td>
<td>${data[i].score}</td>
<td>${data[i].username}</td>
<td>${data[i].address}</td>
<td>${data[i].lastseen}</td>
</tr>`
table.innerHTML +=row;
}
}
note that for testing purposes im just starting to get a token name in of my balances, down the line i want to populate it with other elements from the backend that will be fed into it from my game dapp. Anyhow - what am i missing exactly to avoid the error?
thank you!