I have an object
{
'Bob Joerson': [
[ 'Tuesday March 31, 2020', '07:58:12.0' ],
[ 'Wednesday April 1, 2020', '11:00:03.7' ]
],
'Joe Bobberson': [
[ 'Tuesday March 31, 2020', '07:58:12.0' ],
[ 'Wednesday April 1, 2020', '11:00:03.7' ]
]
}
How would I access the information within the array within the array?
I have tried:
<% for(var key in timesheets){ %>
<% if(timesheets.hasOwnProperty(key)){ %>
<% a = 0 %>
<table id="timesheetTable" class='table-primary table-bordered table' style='border-spacing: 10px;'>
<tr>
<td rowspan="2" id="name"> <%= key %> </td>
<% for(var value in key){ %>
<td> <%= value %> </td>
<% } %>
</tr>
</table>
<% a++ %>
<% } %>
<% } %>
But value just outputs the string index for the name stored in key.
When I try
<h1>Timesheet for dates</h1>
<% for(var key in timesheets){ %>
<% if(timesheets.hasOwnProperty(key)){ %>
<% a = 0 %>
<table id="timesheetTable" class='table-primary table-bordered table' style='border-spacing: 10px;'>
<tr>
<td rowspan="2" id="name"> <%= key %> </td>
<% for(i = 0; i < key.length; i++){ %>
<td> <%= key %> </td>
<% } %>
</tr>
</table>
<% a++ %>
<% } %>
<% } %>
It just outputs the names over and over again in a table.
keyis the key from your object, but you need the array, so usetimesheets[key]