Infobox programming language
Multi-paradigm: prototype-based, functional, imperative, scripting
year = 1995
Netscape Communications Corporation, Mozilla Foundation
latest_release_version = 1.8
latest_release_date = 2008
typing = dynamic, weak, duck
JScript, JScript .NET
influenced_by = Self, C, Scheme,
Perl, Python, Java
Although best known for its use in
trademarkof Sun Microsystems. It was used under license for technology invented and implemented by Netscape Communications and current entities such as the Mozilla Foundation. [cite web|title=Sun Trademarks|url=http://www.sun.com/suntrademarks/|publisher=Sun Microsystems|accessdate=2007-11-08]
History and naming
Ecma Internationalfor standardization resulting in the standardized version named ECMAScript. [ [http://cgi.netscape.com/newsref/pr/newsrelease289.html Netscape Press Release] ]
structured programmingsyntax in C (e.g.,
; dynamic typing: As in most scripting languages, types are associated with values, not
variables. For example, a variable
duck typing. [cite book
last = Flanagan
first = David
authorlink = David Flanagan
year = 2006
pages = pp. 176-178
object-based. Objects are associative arrays, augmented with prototypes (see below). Object property names are associative array keys:
obj.x = 10and
obj ["x"] = 10are 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
evalfunction that can execute statements provided as strings at run-time.
newcreates a new object and calls that function with its local
thiskeyword bound to that object for that invocation. The function's
prototypeproperty determines the new object's prototype.; functions as methods : Unlike many object-oriented languages, there is no distinction between a function definition and a method definition. Rather, the distinction occurs during function calling; a function can be called as a method. When a function is invoked as a method of an object, the function's local
thiskeyword is bound to that object for that invocation.
formal parameters and the local
argumentsobject.; array and object literals: Like many scripting languages, arrays and objects (associative arrays in other languages) can be created with a succinct shortcut syntax. The object literal in particular is the basis of the
Use in web pages
HTMLpages and interact with the Document Object Model(DOM) of the page. Some simple examples of this usage are:
* Opening or popping up a new window with programmatic control over the size, position, and attributes of the new window (i.e. whether the menus, toolbars, etc. are visible).
Validationof web form input values to make sure that they will be accepted before they are submitted to the server.
* Changing images as the mouse cursor moves over them: This effect is often used to draw the user's attention to important links displayed as graphical elements.
Furthermore, scripts will not work for all users. For example, a user may:
* use an old or rare browser with incomplete or unusual DOM support,
* use a PDA or
* or be visually or otherwise disabled and use a speech browser
cross-site scripting, or XSS, a violation of the same-origin policy. XSS vulnerabilities occur when an attacker is able to cause a trusted web site, such as an online banking website, to include a malicious script in the webpage presented to a victim. The script in this example can then access the banking application with the privileges of the victim, potentially disclosing secret information or transferring money without the victim's authorization.
XSS vulnerabilities can also occur because of implementation mistakes by browser authors. [MozillaZine, [http://www.mozillazine.org/talkback.html?article=4392 Mozilla Cross-Site Scripting Vulnerability Reported and Fixed] ]
XSS is related to
cross-site request forgeryor XSRF. In XSRF one website causes a victim's browser to generate fraudulent requests to another site with the victim's legitimate HTTP cookiesattached to the request.
Misunderstanding the client-server boundary
obfuscated codecan be reverse engineered.
title = Right-click “protection”? Forget about it
journal = blog.anta.net
url = http://blog.anta.net/2008/06/17/right-click-%e2%80%9cprotection%e2%80%9d-forget-about-it/
issn = 1797-1993
accessdate = 2008-06-17 ]
Browser and plugin coding errors
buffer overflows. These flaws can allow attackers to write scripts which would run any code they wish on the user's system.
Plugins, such as video players,
andbox implementation errors
Some versions of
Uses outside web pages
ActionScript, the programming language used in Adobe Flash, is another implementation of the ECMAScript standard.
* Apple's Dashboard Widgets, Microsoft's Gadgets,
* Tools in the
Java programming language, in version SE 6 (JDK 1.6), introduced the
* Applications on the social network platform
* Newer versions of the Qt C++ toolkit include a
javax.script. [Trolltech ASA, [http://doc.trolltech.com/4.3/qtscript.html QtScript Module] ]
* The interactive music signal processing software
* Late Night Software's
MacOSobject for interaction with the operating system and third-party applications. [
* ECMAScript was included in the VRML97 standard for scripting nodes of VRML scene description files.
* Some high-end Philips
GeoPDFToolbar and Adobe Acrobat and Reader.
debuggerbecomes invaluable when developing large, non-trivial programs. Because there can be implementation differences between the various browsers (particularly within the Document Object Model) it is useful to have access to a debugger for each of the browsers a web application is being targeted at.
Internet Explorer has three debuggers available for it:
Web applications within Firefox can be debugged using the Firebug plug-in, or the older
Drosera is a debugger for the
WebKitengine [ [http://webkit.org/blog/61/introducing-drosera/ Introducing Drosera - Surfin' Safari] ] on Macintosh and Windows [ [https://bugs.webkit.org/show_bug.cgi?id=16314 Bug tracker discussion on Drosera Windows support] ] powering Apple's Safari.
ECMAScript, three editions of which have been published since the work started in November 1996.
Mozilla browsers currently support
Comparison of layout engines (ECMAScript)
*cite book |last=McFarlane |first=Nigel |title=Rapid Application Development with Mozilla |year=2003 |publisher=Prentice Hall Professional Technical References |isbn=0-13-142343-6
* Mozilla Developer Center
Wikimedia Foundation. 2010.