JavaScript Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 2.00

What Is JavaScript?

This section provides a quick description of what is JavaScript.

What is JavaScript? JavaScript is a scripting language mainly used for writing dynamic Web pages. When a script written in JavaScript is embedded in a Web page, it will be executed by the Web browser on the client machine.

The history of JavaScript is nicely summarized on wikipedia.org as:

JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, later LiveScript, and finally renamed to JavaScript. The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. JavaScript was first introduced and deployed in the Netscape browser version 2.0B3 in December of 1995. The naming has caused confusion, giving the impression that the language is a spinoff of Java and has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web-programming language.

To avoid trademark issues, Microsoft named its implementation of the language JScript. JScript was first supported in Internet Explorer version 3.0, released in August 1996 and included Y2K compliant date functions, unlike those based on java.util.Date in JavaScript at the time.

Netscape submitted JavaScript to Ecma International for standardization resulting in the standardized version named ECMAScript.

As a programming language, JavaScript has the following unique features:

  • JavaScript is a scripting language - Source code is interpreted, instead of compiled and executed. Like most other interpreted languages, it does support the eval(source_code) function.
  • JavaScript is a dynamic typing language - Data types are associated with values, instead of variables. In other words, variables are declared without specific data types. They can be assigned with values of any data type.
  • JavaScript is a prototype-based language - Prototypes, instead of classes, are used for defining object properties, methods, and inheritance.
  • JavaScript uses associative arrays to represent objects - Property names and values are stored as associative array elements. Properties and their values can be added, changed, or deleted at run-time.
  • JavaScript supports functions as first-class functions - Functions are really objects. Like regular objects, functions can be created during execution, stored in data structure, and passed to other functions as arguments.

As of 2008, the latest version of the JavaScript is 1.8.

Sections in This Chapter

What Is JavaScript?

First JavaScript - "Hello World!"

Walking through the First JavaScript

The document.write() Method

Dr. Herong Yang, updated in 2008
What Is JavaScript?