JavaScript is a scripting language most often used for client-side web development. It was the originating dialect of the ECMAScript standard. It is a dynamic, weakly typed, prototype-based language with first-class functions. JavaScript was influenced by many languages and was designed to look like Java, but be easier for non-programmers to work with.[1][2] The language is best known for its use in websites (as client-side JavaScript) but is also used to enable scripting access to objects embedded in other applications (for example Microsoft Gadgets in the Windows Sidebar).
JavaScript, despite the name, is essentially unrelated to the Java programming language though both have the common C syntax, and JavaScript copies many Java names and naming conventions. The language was renamed from LiveScript in a co-marketing deal between Netscape and Sun in exchange for Netscape bundling Sun's Java runtime with their then-dominant browser. The key design principles within JavaScript are inherited from the Self programming language.
"JavaScript" is a trademark of Sun Microsystems. It was used under license for technology invented and implemented by Netscape Communications and current entities such as the Mozilla Foundation.[3]avaScript 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 spin-off 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.[4][5]
Microsoft named its dialect of the language JScript to avoid trademark issues. 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. The dialects are perceived to be so similar that the terms "JavaScript" and "JScript" are often used interchangeably (including in this article). Microsoft, however, notes dozens of ways in which JScript is not ECMA compliant.
Netscape submitted JavaScript to Ecma International for standardization resulting in the standardized version named ECMAScript.[6]
[edit] Features
[edit] Structured programming
JavaScript supports all the structured programming syntax in C, e.g. if statements, while loops, switch statements, etc. One partial exception is scoping: C-style block-level scoping is not supported. However, JavaScript 1.7 supports block-level scoping with the let keyword.
[edit] Dynamic programming
dynamic typing
As in most scripting languages, types are associated with values, not variables. For example, a variable x could be bound to a number, then later rebound to a string. JavaScript supports various ways to test the type of an object, including duck typing.
objects as associative arrays
JavaScript is heavily object-based. Objects are associative arrays, such that object property names are associative array keys. obj.x = 10 and obj["x"] = 10 are equivalent, the dot notation being merely syntactic sugar. Properties and their values can be added, changed, or deleted at run-time. The properties of an object can also be enumerated via a for...in loop.
interpreted
Conforming JavaScript engines must be able to interpret (as opposed to compile) source code. This allows JavaScript to include an eval function.
[edit] Function-level programming
first-class functions
Functions are first-class; they are objects themselves. As such, they have properties a
Answered by
Mohd Farooq
, an ibibo Master,
at
3:28 PM on May 01, 2008