JavaScript

From Knowino
Jump to: navigation, search

JavaScript is an interpreted computer language. It is a scripting language and as such it has fewer capabilities than full-fledged computer languages like C, Java, or C++. JavaScript scripts must be embedded in a host environment, such as a Webbrowser or Windows Script Host. JavaScript has no built-in support for reading or writing files, such actions must be performed by the host. Being present in all Webbrowsers of today (2011), JavaScript is probably used more than any other programming language in the world.

Brendan Eich designed the language for one of the early Webbrowsers, Netscape Navigator, and gave it the name LiveScript. LiveScript was part of Netscape Navigator 2.0, released in September 1995. In an announcement of Netscape and Sun Microsystems dated December 4, 1995 the language was renamed to JavaScript; it is generally assumed that the name change was for marketing reasons. The name is somewhat unfortunate because it seems to imply that JavaScript is a scripting, light weight, version of Java, which it is not. However, its syntax (loops, Boolean expressions, etc.) is similar to the syntax of Java.

JavaScript is a loosely typed language. Loosely typed means that the data types of variables are not declared explicitly. One cannot fix a priori that a variable is a number, a string, or any other of the data types allowed by JavaScript.

JavaScript is often described as object oriented, but it is better called prototype oriented, a concept that was pioneered in the programming language Self. A prototype is a property of a constructor function that can be created and changed dynamically (during execution of the script). The inheritance of properties of instances proceeds through the prototypes of objects in the inheritance chain.

JavaScript shares with functional languages as Lisp and its dialect Scheme the fact that functions are first class entities. This means that functions can be assigned to a variable, returned from function calls, and enter functions as argument.

Personal tools
Variants
Actions
Navigation
Community
Toolbox