I recently developed a JavaScript function that involves defining an array and then appending the values of that array to an HTML table. However, I am facing an issue with increasing the array index dynamically.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="table table-striped">
<thead>
<tr>
<th id="time">Time Stamp</th>
<th id="tmpr">Temperature</th>
<th id="crrt">Current</th>
</tr>
</thead>
<tbody id="abc">
</tbody>
</table>
<script>
$(document).ready(function storetime() {
var tim = [
["11:34:4", 30, 31],
["11:34:5", 34, 35],
["11:34:6", 37, 39]
];
$.each(tim, function(i, val) {
$("#abc").append(
`<tr><td> (` + val[0] + `)</td> <td> (` + val[1] + `)</td></tr>`
);
});
});
</script>