I have a problem with iterating objects on EJS. I am connected to a DB on the backend, and I can console log the objects but when I run it through the front end, I get a result of [Object]
Here is the code on my code in the backend
app.get('/usageData', (req, res) => {
tableSvc.queryEntities('usageData', query, null, function (error, result, response) {
if (!error) {
Object.keys(result).forEach(function(key){
const final=result[key]
res.render("usage",{final})
})
} else {
console.log(error)
}
});
});
And on EJS:
<ul>
<table >
<table class="table table-hover">
<thead>
<tr class="indexs">
<th scope="col">PartitionKey</th>
<th scope="col">RowKey</th>
<th scope="col">Action</th>
<th scope="col">SelectedReports</th>
<th scope="col">reportInterval</th>
</tr>
</thead>
<tbody>
<tr>
<% for(var i in final) { %>
<tr style="font-size: 15px">
<td><%= final[i].PartitionKey %> </td>
<td><%= final[i].RowKey %> </td>
<td><%= final[i].Action %> </td>
<td><%= final[i].SelectedReports %> </td>
<td><%= final[i].reportInterval %> </td>
</tr>
<% } %>
</tr>
</tbody>
</table>
</table>
</ul>