Updated: 03/06/2020 by Computer Hope
JavaScript or JS logo

Developed by Brendan Eich and originally known as LiveScript, the programming language JavaScript was renamed in 1995 and now a trademark of Oracle.

JavaScript is an interpreted client-side scripting language that allows a web designer the ability to insert code into their web page. JavaScript is commonly placed into an HTML (hypertext markup language) or ASP (Active Server Pages) file and runs directly from the web page and today is the most popular programming language. JavaScript can perform more advanced tasks, such as printing the time and date, creating a calendar, or other tasks that are not possible in HTML.

What is required to run JavaScript?

JavaScript only requires an Internet browser with JavaScript enabled, which all browsers have by default.

Is JavaScript safe?

Because JavaScript is downloaded from an unknown origin and executed on your computer, JavaScript could have the potential of being malicious. To address this issue, Sun implemented tight security features from the earlier stages of development. These features include:

  • When the browser runs the JavaScript, it's isolated to the browser process. Browsers, like Chrome and Edge, sandbox JavaScript as an additional security measure.
  • JavaScript cannot read from or write to the hard drive or another storage device connected to the computer.

However, even with the above safety measures, anything connected to the Internet is never 100% safe and a computer can be compromised using JavaScript. To help possible security breaches JavaScript can be disabled. However, most sites today require JavaScript to be fully operational. Alternatively, you can make sure to always make sure you're running the latest version of your browser to help keep safe. There are also browser add-ons that can be installed to help control JavaScript or its features on websites.

Are Java and JavaScript the same thing?

No. Java and JavaScript are two different computer programming languages with a few similarities. To learn one of the languages and want to develop features for the Internet and websites, learn JavaScript. To develop applications (e.g., a game that runs on a computer or smartphone without needing a browser) learn Java. See our Java definition for further information about Java.

Hello, World! in JavaScript

<! -- Hide from old browsers
document.write('Hello World!');
// Stop hide -->

With HTML5, you no longer need to specify the language attribute.

Live example of JavaScript

Below is an example of a JavaScript implemented into this page that prints the current time and date. Like all JavaScript files, the user's Internet browser must be capable of viewing JavaScript and the execution of JavaScript must be enabled. If JavaScript is not enabled, the time and date are not visible.


See the JavaScript time and date source code to use these JavaScript features in a web page.

Although JavaScript files are often embedded into the HTML file, users can also save their JavaScript code in an external file. This file often ends with a .js file extension.

List of JavaScript example scripts

Below is a list of JavaScript examples we've collected and created that help demonstrate different abilities of JavaScript and include into your website.

Bookmarklet, CamelCase, Grasshopper, Java, JavaScriptCore, JavaScript Hijacking, jQuery, JScript, LiveScript, Programming terms, Server-side scripting, Userscript, VBScript, Web design terms