JavaScript 1.5 Beta released, see the JavaScript 1.5 announcement for more information.
JavaScript is the Netscape-developed object scripting language used in millions of web pages and server applications worldwide. Netscape's JavaScript is a superset of the ECMA-262 Edition 3 (ECMAScript) standard scripting language, with only mild differences from the published standard.
Contrary to popular misconception, JavaScript is not "Interpretive
Java". In a nutshell, JavaScript is a dynamic scripting language
supporting
prototype based object construction. The basic syntax is
intentionally similar to both Java and C++ to reduce the number of
new concepts required to learn the language. Language constructs,
such as if
statements, for
and while
loops,
and switch
and try ... catch
blocks function the
same as in these languages (or nearly so.)
JavaScript can function as both a procedural and an object oriented language. Objects are created programmatically in JavaScript, by attaching methods and properties to otherwise empty objects at run time, as opposed to the syntactic class definitions common in compiled languages like C++ and Java. Once an object has been constructed it can be used as a blueprint (or prototype) for creating similar objects.
JavaScript's dynamic capabilities include runtime object
construction, variable parameter lists, function variables, dynamic
script creation (via eval
), object introspection (via
for ... in
), and source code recovery (JavaScript programs
can decompile function bodies back into their source text)
Intrinsic objects are Number
,
String
, Boolean
, Date
, RegExp
, and
Math
.
For a more in depth discussion of JavaScript programming follow the Language and Scripting Resources links in the table below.
mozilla.org hosts two JavaScript implementations. The first ever JavaScript was created by Brendan Eich at Netscape, and has since been updated (in JavaScript 1.5) to conform to ECMA-262 Edition 3. This engine, code named SpiderMonkey, is implemented in C. The Rhino engine, created primarily by Norris Boyd (also at Netscape) is a JavaScript implementation in Java. Like SpiderMonkey, Rhino is ECMA-262 Edition 3 compliant.
Each mozilla.org JavaScript engine exposes a public API applications can call on for JavaScript support. By far, the most common host environment for JavaScript is web browsers. Web browsers typically use the public API to create 'host objects' responsible for reflecting the DOM into JavaScript.
Another common application for JavaScript is as a (web) server side scripting language. A JavaScript web server would expose host objects representing a HTTP request and response objects, which could then be manipulated by a JavaScript program to dynamically generate web pages.
For more information on embedding JavaScript in you own applications, follow either the SpiderMonkey or Rhino links below, or visit us on the netscape.public.mozilla.jseng newsgroup.
Site | Description |
---|---|
SpiderMonkey Embedding | Information specific to JavaScript in C engine (aka SpiderMonkey) embedding. |
Rhino Embedding | Information specific to JavaScript in Java engine (aka Rhino) embedding. |
Language Resources | Pointers to published JavaScript standards, LiveConnect documents, and work on JavaScript 2.0. |
Scripting Resources | Pointers to JavaScript scripting resources, including recommended reading, online references and tutorials, and sample code. |
Projects Page | Lists other projects using the open source JavaScript engines. |
Test Library Page | Information about the core JavaScript test suite. |
netscape.public.mozilla.jseng comp.lang.js | The netscape.public.mozilla.jseng newsgroup is for discussion about the JavaScript engines, browser scripting issues can be directed to the comp.lang.js forum. |
netscape.devs-javascript | Newsgroup for discussion of Client Side JavaScript in Netscape browsers only. |