In both of these, the string content is the same. If you do this:
myDiv.innerHTML += "<table><tr><td>A</td><td>B</td></tr></table>";
You get a table with two columns.
If you do this:
myDiv.innerHTML += "<table>";
myDiv.innerHTML += "<tr>";
myDiv.innerHTML += "<td>A</td>";
myDiv.innerHTML += "<td>B</td>";
myDiv.innerHTML += "</tr>";
myDiv.innerHTML += "</table>";
You only get the <table></table>
tags. No other markup is present.
Is this because JavaScript changes the meaning of the content to objects, then we are not adding the TD's to the Table object? Why would this be the case?