How to Create a Js File

To create a Js (JavaScript) file simply remove the SCRIPT tags and save the JavaScript code with a .js extension using Notepad. This allows you to call the JavaScript when needed, instead of having the JavaScript code typed out in the HTML (Hyper Text Markup Language) code. The SCRIPT tags are removed to make the .js file and are added to the HTML file of a web page with a reference to the .js file created. This method can be used with any web page.

...
File of Zeroes and Ones

Step

Launch "Notepad."

Step

Type out your code. For example:

Step

alert("You are running the " + navigator.appName + " browser.").

Step

This is the JavaScript without the SCRIPT tags. Before the SCRIPT tags are removed the JavaScript looks like the following:

Step

Step

Click "File," "Save" and the "Save As" dialog box is displayed.

Step

Type "myfile.js" and click the "Save" button. Now you have created a .js file. By adding,