JavaScript language (Overview)

JavaScript overview summary.


ECMAScript edition - 2

JavaScript is a so-called third generation language.

JavaScript was originally developed by Netscape Communications and is influenced by many other languages. Most notably, it borrows from:

This means that if you have already used any of these other languages, it is likely that you will become proficient in JavaScript fairly quickly.

JavaScript and Java are two distinctly different languages. They even operate in a different architectural way. JavaScript is interpreted while Java is compiled. It is a lot simpler to get started using JavaScript and designers find it's a good way to become accustomed to the more intense software developer issues.

Java code tends to be quite self-contained and not require the help of any additional systems. On the other hand, JavaScript is often more like a kind of glue that joins various parts of the web together so they can inter-operate more effectively.

JavaScript is object-based. That is to say, the basic language operation and access to the hosting environment is by means of objects that represent items in the real world. A JavaScript application is built from a collection of various kinds of objects, which communicate with one another.

Every JavaScript environment comes with a set of Core Objects. These provide the fundamental basis on which the language is built. It is these objects that are defined in the ECMAScript standard. There is a Global Object which is the topmost object in the hierarchy. Other objects such as the Math Object provide more specialised capabilities.

In JavaScript we talk about primitive values having a type. There are a set of standard types built-in to the core JavaScript interpreter. Although JavaScript is object-based, it is not a class based object oriented language, and so while these Primitive Types behave very much like object oriented classes, they aren't really implemented as such. The language does provide some facilities for creating new object types however.

An Object in the JavaScript environment is a collection of Properties which you can access by name. Some you can only access in a read-only fashion while others can be modified. The Properties have attributes such as a read-only flag, which controls this access to the values contained in the property. Properties may have other attributes as well and can often be a reference to another object. Requesting a property from an object can therefore yield another object, which in turn has properties of its own. If you think of the properties as containers you'll soon feel comfortable with the concept.

Objects can also respond to messages, each of which will invoke a named Method. Those methods may behave much like a property request or they may cause some action to happen. At the JavaScript programming level, methods and properties begin to lose their distinction. Methods are often analogous to Functions in other languages. Indeed, methods are implemented as functions that are attached to objects by means of properties. You may use functions in a traditional way, very much like you would in C, but the functions you use in the scripts are actually methods that belong to the global object. However, in that case you don't need to specify which object should execute the method.

The syntax of JavaScript intentionally mimics that of Java but many rules are relaxed to make the language easier to use. For example, you don't need to declare the type of a variable before using it. Properties don't need to have their type specified and functions do not need to be placed earlier in the script than when they are first invoked.

Although JavaScript is intended to be forgiving and therefore easy to be comfortable with and yet not be a hard-core programmer, beyond the simple basics, it certainly is not a simple language to learn and exploit fully.

See also:Constant expression, Declaration, ECMAScript, Expression, Free-format language, History, int, JavaScript version, Lexical element, LiveScript, Native feature, Overview, Statement


ECMA 262 edition 2 - section - 4.2

ECMA 262 edition 3 - section - 4.2

O'Reilly JavaScript Definitive Guide - page - 2

Wrox Instant JavaScript - page - 1

Wrox Instant JavaScript - page - 11