Demonstration of write/writeln functions and do/while loop
The JavaScript code:
document.writeln('<p>Odd integers from 1 to 100:');
var sum = 0;
var i = 1;
do {
document.write(' ' + i);
sum += i;
i += 2;
} while (i <= 100);
document.writeln('</p>');
document.writeln('<p>The sum is: ' + sum + '</p>');