JavaScript is a programming language that is mainly used to create various effects in web pages. The purpose of this page, however, is to introduce JavaScipt as a language to study the basics of programming.

The table below contains links to simple JavaScript programs that can be executed with Node.js, which is a JavaScript runtime. (More information at the end of this page.)

The following links should be helpful when you study the basics with JavaScript.



How to execute the above programs?

To execute the above programs you need to install Node.js software. From you can get installers for several operating systems. For Windows, you can get a ready-to-run file named node.exe. On my Windows computer the Node.js 'installation' is such that I have downloaded the file node.exe and stored it in folder C:\freeware.

The above programs can be downloaded by Right-clicking the links, the file names. For example, if I download the file Game.js and put it into a folder named C:\javascriptwork, I can execute the program by giving the following commands in the Command Prompt Window

   cd javascriptwork
   C:\freeware\node Game.js

On my computer it is necessary to type C:\freeware\node and the file name to run a program. Doing this typing is not actually a problem because it is possible to repeat the commands with the Arrow-Up and Arrow-Down keys. All the above programs have been developed so that I have written them with the free Notepad++ editor and then executed with commands such as the one above.

If you are using a macOS computer, you need first to install Node.js with an installer. Then, if you download the file Game.js and put it into a subfolder named javascriptwork inside the Documents folder, you should be able to execute the program with the following commands in a Terminal window.

   cd Documents
   cd javascriptwork
   node Game.js