As Shahar mentioned, the way to see the output on the actual web page is to add it into a DOM object. For example, if we create a div for the output and add output into it by using jQuery:
HTML:
<div id="output"><div>
Javascript, using jQuery:
// your example output
var string = "hello";
// append to end of output div
function outputToPage() {
$('#output').append(string + "<br/>");
}
The above example would output string
and line-break to the output div, whenever outputToPage()
function is called. Please note that you need to have jQuery loaded for the jQuery's .append()
method to work.