Ch1 - Output   .   Ch2 - Sequence    .   Ch3 - Variables    .    Ch4 - Input

Ch5 - If decisions    .    Ch6 - While loops   .    Ch7 - Functions

JT Home Page


Chapter 1

Using JT

Internet Explorer is recommended (see why). Open up JT in a seperate browser window, alongside this window. Do this by right-clicking here (or here for old low-resolution screens). Enter your programs in the large area at the left. Often, you will copy code from another window and paste it into JT. Here is how: Your programs will be small, but if you want to save them, open up a copy of notepad, paste the code into it, and save it in a file.

To execute the program, click Run.

Click Trace to step it a line at a time. In the pop-up box, click OK to step to the next instruction. To stop tracing, click Cancel. (A JavaScript error will be shown, for line 200. Ignore this by choosing the No option. Ideally, switch off Javascript errors in your browser)

Click Pretty to format the code neatly.

The display in the top left quarter shows line numbers and variable values. This is refreshed after every assignment statement is executed (i.e. whenever any variable changes). You will use this feature later.

Now we will write some programs.

Displaying Text with print, printLine, and alert

Here we look at how we display information, such as results from calculations. Copy the program from below, and paste it into JT. If you don't have a JT window open already, do this now by right-clicking here

or here******.

Click on the 'Run' button, and note the text that appears in the bottom-right Results area. It is:

Hello World
on a single line.

Here, some introductory points are covered, to be explained in more depth later.

The semicolon ends every statement - the problem is that every line of the above is not technically a statement so you can't litter semicolons around with abandon. In fact, there is only one statement - the print - in the above.

Note on Browsers

IE is recommended at present. The Mozilla version does not work with blank lines. Put a space on blank lines if you use e Mozilla)

Ch1 - Output   .   Ch2 - Sequence    .   Ch3 - Variables    .    Ch4 - Input

Ch5 - If decisions    .    Ch6 - While loops   .    Ch7 - Functions

JT Home Page