Tom's JavaScript Machine

[ Machine | Instructions | Examples | JavaScript Basics | Challenge | Hints | About ]

Some Example Programs

Here are some programs to illustrate the special features of Tom's JavaScript Machine. To try a program, click its Try button: the program is copied into Tom's JavaScript Machine, ready for you to run it.

Output Hello World!
Input:

Not needed

Program: Output:
Output Hello World! twice
Input:

Not needed

Program: Output:
Output Hello World! twice with a user-defined function
Input:

Not needed

Program: Output:
Output the program to output Hello World!
Input:

Not needed

Program: Output:
Output the program to output Hello World! using a variable to store the program
Input:

Not needed

Program: Output:
Copy the input
Input: Program: Output:
Determine the input's length
Input: Program: Output:
Sum all input numbers
Input: Program: Output:
Count the number of lines in the input (lines are assumed to be terminated by a newline)
Input: Program: Output:
Count the number of lines in the input with a user-defined function
Input: Program: Output:
Count the number of words and lines in the input
Input: Program: Output:

Valid HTML 4.01 Transitional

©2009-2010, Tom Verhoeff (TU/e)
Feedback about this page is welcome