I'm trying to format a table of data as a string and return it to the page. I have the following, but I'm afraid this isn't a valid way to define my variable.
var tableOutput = ' <
table class = \"child-info\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\" style=\"padding-left:50px;\">'+
'<tr>' +
'<td>Level:</td>' +
'<td>' + d.deg_codes[0] + '</td>' +
'</tr>' +
'<tr>' +
'<td>Level:</td>' +
'<td>' + d.deg_codes[1] + '</td>' +
'</tr>' +
'</table>';
return tableOutput;
However, it works when I just return the entire definition statement by itself. Unfortunately, I need it as a variable to be able to modify it. Is there a better way to define this? Or do I have to do a huge number of appends?
EDIT:
Got it working as:
var tableOutput = `
<table class = "child-info" cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">
<tr>
<td>Level USF Tampa:</td>
<td>${d.deg_codes[0]}</td>
</tr>
<tr>
<td>Level USF Tampa:</td>
<td>${d.deg_codes[1]}</td>
</tr>
</table>`;