aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/javascript/about_javascript/index.html
blob: 26c921724f97353c404453e83385762e8c75d0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: O JavaScript
slug: Web/JavaScript/O_JavaScript
translation_of: Web/JavaScript/About_JavaScript
---
<div>{{JsSidebar}}</div>

<h2 id="Co_to_jest_JavaScript">Co to jest JavaScript?</h2>

<p><strong>JavaScript</strong><sup>®</sup> (w skrócie <strong>JS</strong>) jest lekkim, interpretowanym, zorientowanym obiektowo językiem z funkcjami <a href="https://en.wikipedia.org/wiki/First-class_function" title="https://en.wikipedia.org/wiki/First-class_function">pierwszej klasy</a>, i jest najbardziej znany jako język skryptowy dla stron sieci Web, ale jest także <a class="external" href="https://en.wikipedia.org/wiki/JavaScript#Uses_outside_web_pages">używany w wielu innych środowiskach niż przeglądarka</a>. It is a <a class="mw-redirect" href="https://en.wikipedia.org/wiki/Prototype-based_programming" title="Prototype-based">prototype-based</a>, multi-paradigm scripting language that is dynamic, and supports object-oriented, imperative, and functional programming styles.</p>

<p>JavaScript działa po stronie klienta, co można wykorzystać w projektowaniu / programowaniu jak strona ma się zachowywać w przypadku wystąpienia jakiegoś zdarzenia. JavaScript jest łatwym do opanowania i jednocześnie potężnym językiem skryptowym, powszechnie używany do kontrolowania zachowania strony internetowej.</p>

<p>Wbrew powszechnemu przekonaniu, <strong>JavaScript <em>nie </em>jest "zinterpretowaną Java"</strong>. W skrócie, JavaScript jest dynamicznym językiem skryptowym obsługującym prototypową konstrukcję obiektów. Podstawowa składnia jest celowo podobna zarówno do Java i C++, aby zmniejszyć liczbę nowych pojęć potrzebnych do nauki języka. Konstrukcje językowe, takie jak istrukcje <code>if</code><code>switch</code>, pętle <code>for</code> i <code>while</code>, oraz blok <code>try ... catch</code> funkcjonują tak samo w tych językach (lub bardzo podobnie).</p>

<p>JavaScript może funkcjonować jako język <a class="external" href="https://en.wikipedia.org/wiki/Procedural_programming" title="https://en.wikipedia.org/wiki/Procedural_programming">proceduralny</a>, jak również <a class="external" href="/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript" title="https://developer.mozilla.org/en-US/docs/Introduction_to_Object-Oriented_JavaScript">język zorientowany obiektowo</a>. Obiekty w JavaScript są tworzone automatycznie, poprzez dołączenie metod i właściwości do pustego obiektów <strong>w czasie wykonywania</strong>, w przeciwieństwie do definicji składniowych klasy wspólnych zestawionych w językach takich jak C ++ i Java. Raz stworzony obiekt może być stosowany jako projekt (lub prototyp) do tworzenia podobnych obiektów.</p>

<p>JavaScript's dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval" title="en-US/docs/JavaScript/Reference/Global_Functions/eval">eval</a></code>), object introspection (via <code>for ... in</code>), and source code recovery (JavaScript programs can decompile function bodies back into their source text).</p>

<p>For a more in depth discussion of JavaScript programming follow the <a href="#JavaScript_resources">JavaScript resources</a> links below.</p>

<h2 id="What_JavaScript_implementations_are_available">What JavaScript implementations are available?</h2>

<p>The Mozilla project provides two JavaScript implementations. The first <strong>ever</strong> JavaScript was created by Brendan Eich at Netscape, and has since been updated to conform to ECMA-262 Edition 5 and later versions. This engine, code named <a href="/en-US/docs/Mozilla/Projects/SpiderMonkey" title="en-US/docs/SpiderMonkey">SpiderMonkey</a>, is implemented in C/C++. The <a href="/en-US/docs/Rhino" title="en-US/docs/Rhino">Rhino</a> engine, created primarily by Norris Boyd (also at Netscape) is a JavaScript implementation written in Java. Like SpiderMonkey, Rhino is ECMA-262 Edition 5 compliant.</p>

<p>Several major runtime optimizations such as TraceMonkey (Firefox 3.5), JägerMonkey (Firefox 4) and IonMonkey were added to the SpiderMonkey JavaScript engine over time. Work is always ongoing to improve JavaScript execution performance.</p>

<p>Besides the above implementations, there are other popular JavaScript engines such as:-</p>

<ul>
 <li>Google's <a class="external" href="https://code.google.com/p/v8/" title="https://code.google.com/p/v8/">V8</a>, which is used in the Google Chrome browser and recent versions of Opera browser. This is also the engine used by <a href="http://nodejs.org">Node.js</a>.</li>
 <li>The <a class="external" href="https://www.webkit.org/projects/javascript/index.html" title="https://www.webkit.org/projects/javascript/index.html">JavaScriptCore</a> (SquirrelFish/Nitro) used in some WebKit browsers such as Apple Safari.</li>
 <li><a class="external" href="http://my.opera.com/ODIN/blog/carakan-faq" title="http://my.opera.com/ODIN/blog/carakan-faq">Carakan</a> in old versions of Opera.</li>
 <li>The <a class="external" href="http://en.wikipedia.org/wiki/Chakra_%28JScript_engine%29" title="http://en.wikipedia.org/wiki/Chakra_%28JScript_engine%29">Chakra</a> engine used in Internet Explorer (although the language it implements is formally called "JScript" in order to avoid trademark issues).</li>
</ul>

<p>Each of Mozilla's JavaScript engines expose a public API which application developers can use to integrate JavaScript into their software. By far, the most common host environment for JavaScript is web browsers. Web browsers typically use the public API to create <strong>host objects</strong> responsible for reflecting the <a class="external" href="http://www.w3.org/DOM/">DOM</a> into JavaScript.</p>

<p>Another common application for JavaScript is as a (Web) server side scripting language. A JavaScript web server would expose host objects representing a HTTP request and response objects, which could then be manipulated by a JavaScript program to dynamically generate web pages. <a href="http://nodejs.org">Node.js</a> is a popular example of this.</p>

<h2 id="JavaScript_resources">JavaScript resources</h2>

<dl>
 <dt><a href="/en-US/docs/Mozilla/Projects/SpiderMonkey" title="en-US/docs/SpiderMonkey">SpiderMonkey</a></dt>
 <dd>Information specific to Mozilla's implementation of JavaScript in C/C++ engine (aka SpiderMonkey), including how to embed it in applications.</dd>
</dl>

<dl>
 <dt><a href="/en-US/docs/Rhino" title="en-US/docs/Rhino">Rhino</a></dt>
 <dd>Information specific to the JavaScript implementation written in Java (aka Rhino).</dd>
 <dt><a href="/en-US/docs/Web/JavaScript/Language_Resources" title="en-US/docs/JavaScript_Language_Resources">Language resources</a></dt>
 <dd>Pointers to published JavaScript standards.</dd>
 <dt><a href="/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript" title="en-US/docs/A_re-introduction_to_JavaScript">A re-introduction to JavaScript</a></dt>
 <dd><a href="/en-US/docs/Web/JavaScript/Guide" title="en-US/docs/JavaScript/Guide">JavaScript guide</a> and <a href="/en-US/docs/Web/JavaScript/Reference" title="en-US/docs/JavaScript/Reference">JavaScript reference</a>.</dd>
</dl>

<p>JavaScript® is a trademark or registered trademark of Oracle in the U.S. and other countries.</p>