JavaScript doesn't generate HTML, unlike php. It (normally) runs directly on the client, in the web browser, and the code you write interacts directly with a representation of the document content. If you create a table in JS you don't "write HTML" - you dynamically create nodes in the DOM, and add HTML elements, and the content of those elements. Having said all that, you can basically add straight HTML to your document if you really want to, but there's not much point. If you want to do that you can just send it direct from the server, via php or anything else.
If you run your JavaScript debugger in your dev tools (Firebug, etc) and look through the document elements (in other words, the HTML) you can generally get some idea of what you've added. You could see HTML for your table, for example. Stand-alone programs aren't good for this, because they need to run your JavaScript first. It's very hard to find an HTML to pdf converter, for example, that can cope with a page that runs JS.