JavaScript Programming

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 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.


 

JavaScript / Node.js videos

Links to videos about the very basics:

Links to videos about object-oriented programming:


 
 
 
 
 
 
 

 

How to execute the above programs?

To execute the above programs you need to install Node.js software. From nodejs.org you can get installers for several operating systems.

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

         C:
         cd javascriptwork
         node Game.js
      

The last command above works only if the Path environment variable is set so that node.exe can be activated. Running programs in the Command Prompt Window is not so difficult when you remember that commands can be repeated 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 them 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