Basic JavaScript Notes

JavaScript debugging tutorial

Here is a tutorial on debugging JavaScript in a web browser. The tutorial includes a short video demonstration of using the Chrome developer tools.

Variables

Here are some important things to know about variables in JavaScript:

Strings

Strings in JavaScript are immutable. That means once a string is created, it can't be changed.

Generating HTML

You can see an example of generating HTML with a detailed explanation on these web pages:
genSample.html A web page with ten h2 headers generated by JavaScript code.
genSample.js The JavaScript code that generates the HTML for genSample.html.
genSampleNotes.html A walk-through of genSample.html and genSample.js

Using JavaScript outside a web browser

The most common way to execute a JavaScript program is inside a web browser. However, there are other ways to execute JavaScript programs, including server-side scripting in Node.js. Other server-side options are Netscape's web server and Microsoft's IIS web server.

Mozilla provides two JavaScript interpreters--Spider Monkey, which is written in C, and Rhino, which is written in Java. These interpreters can be embedded in other programs, which makes an easy way to add a macro or scripting language to another program. In fact, Version 6.0 of Java includes a JavaScript interpreter, so that any Java 6.0 program can execute JavaScript.