• Around The HomeToggle Menu

    • Entertainment
    • Productivity
    • Smart Home
  • FamilyToggle Menu

    • Parenting
    • Toys
    • Pets
    • Travel
  • ReviewsToggle Menu

    • Phones
    • Tablets
    • Laptops
    • Desktops
    • Wearables
    • Audio
    • Cameras
    • Headphones
    • Printers
    • Smart Home
    • TVs
    • Gaming and Video
  • One Cool ThingToggle Menu

    • Frugal Tech
    • Kickstarters
    • Videos
  1. Home
  2. Around The Home
  3. Productivity
  4. How to Create a Js File

How to Create a Js File

By: Maureen Bruen
  • Share
  • Share on Facebook

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:

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

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

Video of the Day

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,

Show Comments

Related Articles

How to Check Null Value in JavaScript

How to Check Null Value in JavaScript

Around The Home
Productivity
By: Lysis
Differences Between JavaScript & HTML

Differences Between JavaScript & HTML

Around The Home
Productivity
By: Lysis
How to Convert VBS to JS

How to Convert VBS to JS

Around The Home
Productivity
By: Elliot Quimby
How to Create a File Without an Extension With Notepad

How to Create a File Without an Extension With Notepad

Around The Home
Productivity
By: Maureen Bruen
How to Open a File in Javascript

How to Open a File in Javascript

Around The Home
Productivity
By: Jim Campbell
How to Open ASP Files

How to Open ASP Files

Around The Home
Productivity
By: Adam Cloe
  • HOW WE SCORE
  • ABOUT US
  • CONTACT US
  • TERMS
  • PRIVACY POLICY
  • COPYRIGHT POLICY
  • Advertise

An error occurred. Try again later.

Thanks for signing up!
© 2019 Leaf Group Ltd. Leaf Group Media

Get great tech advice delivered to your inbox.

Keep your family productive, connected, entertained, and safe.

Please enter a valid email.