I am attempting to generate an HTML table using a given input string that is separated by commas
// HeaderTable = Headers Table
// DataTable = Body Table
Input Values:
headerTable = "Header1,Header2,Header3"
dataTable = [["TEST1,TEST1,TEST1"],["TEST2,TEST2,TEST2"],["TEST3,TEST3,TEST3"]]
Expected response:
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>TEST1</td>
<td>TEST2</td>
<td>TEST3</td>
</tr>
<tr>
<td>TEST1</td>
<td>TEST2</td>
<td>TEST3</td>
</tr>
<tr>
<td>TEST1</td>
<td>TEST2</td>
<td>TEST3</td>
</tr>
</tbody>
</table>
Get back a unique html table code as a string
Desired response format Format Image
My Implementation Jsfiddle