How To Create Java Script

Table of contents:

How To Create Java Script
How To Create Java Script

Video: How To Create Java Script

Video: How To Create Java Script
Video: How To Create Your Very First JavaScript Program 2024, December
Anonim

Java Script is a programming language that is processed by the browser when displaying the content of a website. JS file is an ordinary text document that can be created and edited using standard system tools.

How to create java script
How to create java script

File creation

There are several ways to create a JS file. The program code is stored in the document and does not require additional processing by the compiler program. To create a document that will be read in the system as a script file, right-click on a free area in Windows Explorer or on the desktop. In the context menu that appears, select the "New" - "Text Document" option. Next, you will be asked to set a name for the future file and its extension. If you want the document to correctly connect to the HTML page, it is advisable to give the script a name using Latin letters. After specifying the name, move the cursor to the right past the point immediately following the name. Change the Windows suggested extension ".txt" to ".js" and press Enter. Confirm the operation and modification of the extension. The JS document creation is complete.

Editing

Right click on the newly created file. In the menu that appears, select the "Open with" option. In the list of proposed parameters, select the program through which it will be easiest for you to enter the program code. For example, you can choose the standard Notepad or Wordpad application. If you have any other editors capable of opening JS files, they will also appear in the list. Once opened, you can start entering the code.

When you have finished writing the script, save the changes to the file using the "File" - "Save" command.

You can also create a JS file using Notepad. To do this, open the program by going to the "Start" - "All Programs" - "Standard" - "Notepad". Then start entering the program code. After completing the input, click on the "Save As" button and select the folder in which you would like to save your future Java Script file. Give the file a name and add the extension ".js" after it. This will provide all the necessary parameters to identify the Java Script file in the system.

Thus, the Java Script file can be executed both independently and in the browser window by loading it on the HTML page of the site.

After creating a document, you can run it both in Windows and in the browser installed on your computer via the "Open with" menu. JS file can be included in HTML using a special directive. In this case, the code must be specified in the section of the HTML file.

Recommended: