Tag Info

About

According to the language's creator Brendan Eich, his original inspiration for JavaScript was Scheme. A major requirement handed down to him from management was that the syntax be readily understood by Java developers. Origionally called LiveScript its name was eventually changed to "JavaScript". In all respects, other than sharing part of its name, JavaScript is VERY different from Java.

It is dynamically typed.

Unlike block-scoped languages the scope chain nests via objects and functions. Local vars declared inside a function will be accessible to the remainder of the function regardless of whether they were defined inside a loop or conditional statement. Nested objects and functions have access to local vars declared in ancestors via a native call object that is not exposed to JS.

It is a functional programming language featuring first class functions which can be passed around as data and applied to new contexts while maintaining links to their original environment execution context through closures. (i.e. a nested function with references to a parent function's local variables will hold on to those values when returned even after the parent function has completed execution)

It is a prototype-based OOP language. New properties can be added to the prototype property of object constructors (simply functions invoked with a 'new' keyword used to create objects with an initiation procedure) and objects that have already been instantiated will still inherit the new properties. Unlike class-based approaches, object constructors in JavaScript do not have the native ability to inherit from one another the way classes can inherit down from a series of super-classes. Such behavior is easily authored however.

Object literals (JSON, basically) are also available.

On the web, where it has seen the most use to date, JavaScript's primary role is to handle data on the client-side, communicate asynchronously with servers (AJAX), assign behavior to events, and allow dynamic manipulation of HTML and CSS through tight integration via the W3C DOM API.

Now with open source availability of JIT compiling engines like Google's V8, JavaScript is starting to spread into new territory though environment implementations like node.js, which allows scripting of JS in the context of file systems and server-side operations.

history | show excerpt | excerpt history

Code Language (used for syntax highlighting): lang-js