A widely used programming language embedded within the HTML code of Web pages. JavaScript was introduced in 1995 and is supported by all Web browsers. Along with other functions, JavaScript is used to enable interactive page elements such as navigation buttons and drop-down menus. It is also used to identify the page to analytics servers that capture traffic statistics. JavaScript source code is plain text that resides between Script tags. See
JScript,
TypeScript,
ECMAScript,
Dojo and
VBScript.
HTML5
As of HTML Version 5, JavaScript was formalized as part of HTML, thus turning HTML from a presentation language into a programming language. See
HTML5.
WebAssembly: Low-Level Replacement
JavaScript is an interpreted language, which means the source code remains as readable text the way the programmer wrote it. A runtime engine has to parse (analyze) the text statements in order to execute them. Twenty years after the creation of JavaScript, WebAssembly was created to provide a lower-level language that executes much faster than source code text (see
WebAssembly).
JavaScript vs. Java
JavaScript is not associated with Java as peculiar as that may be. Although both are programming languages, JavaScript is executed merely by retrieving a page from a website. Because it is "sandboxed," JavaScript cannot be used to access local files and probe the user's computer. Java, on the other hand, is a comprehensive programming language that can manipulate any resource in the computer, and both may be used in the same Web-based system. For example, JavaScript could display a data entry form and validate the input, while a Java program in the server processes the information. In addition, JavaScript remains as human-readable text, while Java source code is converted into a binary format (see
bytecode). See
Java,
sandbox and
servlet.
JavaScript Can Be Viewed
JavaScript code in a Web page can be easily viewed in any browser as in this Opera example on a Mac. The blue text is the HTML rendering language, and the brown is JavaScript. In this example, the JavaScript causes navigation buttons to change color when the mouse rolls over and to jump to another page when clicked. See
HTML.