Você está na página 1de 2

What is JavaScript?

JavaScript (often shortened to JS) is a lightweight, interpreted, object-oriented


language with first-class functions, and is best known as the scripting languag
e for Web pages, but it's used in many non-browser environments as well. It is a
prototype-based, multi-paradigm scripting language that is dynamic, and support
s object-oriented, imperative, and functional programming styles.
JavaScript runs on the client side of the web, which can be used to design / pro
gram how the web pages behave on the occurance of an event. JavaScript is an eas
y to learn and also powerful scripting language, widely used for controlling web
page behaviour.
Contrary to popular misconception, JavaScript is not "Interpreted Java". In a nu
tshell, JavaScript is a dynamic scripting language supporting prototype based ob
ject 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 ... c
atch blocks function the same as in these languages (or nearly so.)
JavaScript can function as both a procedural and an object oriented language. Ob
jects are created programmatically in JavaScript, by attaching methods and prope
rties 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 b
een constructed it can be used as a blueprint (or prototype) for creating simila
r 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 ca
n decompile function bodies back into their source text).
For a more in depth discussion of JavaScript programming follow the JavaScript r
esources links below.
What JavaScript implementations are available?
The Mozilla project provides two JavaScript implementations. The first ever Java
Script was created by Brendan Eich at Netscape, and has since been updated to co
nform to ECMA-262 Edition 5 and later versions. This engine, code named SpiderMo
nkey, is implemented in C/C++. The Rhino engine, created primarily by Norris Boy
d (also at Netscape) is a JavaScript implementation written in Java. Like Spider
Monkey, Rhino is ECMA-262 Edition 5 compliant.
Several major runtime optimizations such as TraceMonkey (Firefox 3.5), JgerMonkey
(Firefox 4) and IonMonkey were added to the SpiderMonkey JavaScript engine over
time. Work is always ongoing to improve JavaScript execution performance.
Besides the above implementations, there are other popular JavaScript engines su
ch as:Google's V8, which is used in the Google Chrome browser and recent versions
of Opera browser. This is also the engine used by Node.js.
The JavaScriptCore (SquirrelFish/Nitro) used in some WebKit browsers such as
Apple Safari.
Carakan in old versions of Opera.
The Chakra engine used in Internet Explorer (although the language it implem
ents is formally called "JScript" in order to avoid trademark issues).
Each of Mozilla's JavaScript engines expose a public API which application devel
opers can use to integrate JavaScript into their software. By far, the most comm

on host environment for JavaScript is web browsers. Web browsers typically use t
he public API to create host objects responsible for reflecting the DOM into Jav
aScript.
Another common application for JavaScript is as a (Web) server side scripting la
nguage. A JavaScript web server would expose host objects representing a HTTP re
quest and response objects, which could then be manipulated by a JavaScript prog
ram to dynamically generate web pages. Node.js is a popular example of this.

Você também pode gostar