Formatting UA Discussion

by jarosciak

HTML

<div id="tree"></div>
 <br><hr><br>
<div id="tree-sort"></div>

JavaScript

window.addEventListener('load', (event) => {

console.log("#############################################");

function htmlspecialchars(text){
    var tnd=document.createTextNode(text);
    var div=document.createElement("DIV");
    div.appendChild(tnd);
    return div.innerHTML;
}



function makeTableHTML(data) {
    let result = ['<table border=1>'];
    for(let row of data) {
        result.push('<tr>');
        for(let cell of row){
            result.push(`<td>${cell}</td>`);
        }
        result.push('</tr>');
    }
    result.push('</table>');
    return result.join('\n');
  }



responseArr = [
    {
        "_id": {
            "$oid": "5fea2f4f039fa5fc985bf471"
        },
        "body": [
            {
                "content": "I think this wasn't properly answered before.\n\nSuppose that the Sun and the Earth were the only objects in the\nentire\nuniverse.  Would scientists be able to prove that the Earth was going\naround the Sun and not vice versa?  If so, how?\n\nJozef Jarosciak\n\n*-----------------------*\n        Posted at:\n  www.GroupSrv.com\n*-----------------------*\n"
            }
        ],
        "header": {
            "subject": "SUN and EARTH",
            "message-id": "A",
            "date": "2004-12-30T11:13:46-06:00",
            "from": [
                "Jozef Jarosciak"
            ],
            "references": null
        }
    },
    {
        "_id": {
            "$oid": "5fea2f52039fa5fc985bf489"
        },
        "body": [
            {
                "content": "\"Jozef Jarosciak\" <[email protected]> wrote in message\nnews:[email protected]...\n> I think this wasn't properly answered before.\n>\n> Suppose that the Sun and the Earth were the only objects in the\n> entire\n> universe.  Would scientists be able to prove that the Earth was going\n> around the Sun and not vice versa?  If so, how?\n\nYes.  Conservation of angular momentum.  Trajectories of objects\nlaunched into space w.r.t....