January 2011
Intermediate to advanced
224 pages
5h 43m
English
When you want to run the code shown in this book and play with it, one possibility is to go to http://eloquentjavascript.net/ and use the tools provided there.
Another approach is to simply create an HTML file containing the program and load it in your browser. For example, you could create a file called test.html with the following content:
<html><body><script type="text/javascript">
var total = 0, count = 1;
while (count <= 10) {
total += count;
count += 1;
}
document.write(total);
</script></body></html>Later chapters will tell you a little more about HTML and the way a browser interprets
it. Note that the operation print in the example has been replaced with
document.write. We will see how to create the print
function in Chapter 10 ...