The 'write' and 'writeln' (same as 'write' but with a new line code at the end) functions are used to place strings in the HTML document. When using a function as part of the string to be written you must realize that the string is not written until it has been completely evaluated.

This means that if a function does a write, then that write will occur before first write. e.g.

function xFunction() {
 
write('world');
}
write('Hello '+xFunction());

This example will write 'worldHello ', because the write inside the xFunction completes before the main program write.

Comment on this topic

Topic ID: 150113