aboutsummaryrefslogtreecommitdiff
path: root/files/hu/web/javascript/guide/bevezetés/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/hu/web/javascript/guide/bevezetés/index.html')
-rw-r--r--files/hu/web/javascript/guide/bevezetés/index.html134
1 files changed, 134 insertions, 0 deletions
diff --git a/files/hu/web/javascript/guide/bevezetés/index.html b/files/hu/web/javascript/guide/bevezetés/index.html
new file mode 100644
index 0000000000..3e87f3d12b
--- /dev/null
+++ b/files/hu/web/javascript/guide/bevezetés/index.html
@@ -0,0 +1,134 @@
+---
+title: Bevezetés
+slug: Web/JavaScript/Guide/Bevezetés
+translation_of: Web/JavaScript/Guide/Introduction
+---
+<div>{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide", "Web/JavaScript/Guide/Grammar_and_types")}}</div>
+
+<p class="summary"><span id="result_box" lang="hu"><span>Ez a fejezet</span> <span>bemutatja</span> <span>a JavaScript-et és</span> hozzá kapcsolódó<span> néhány</span> <span>alapvető</span> <span>fogalmat</span><span>.</span></span></p>
+
+<h2 id="Amire_szükséged_lesz_a_megértéshez"><span class="short_text" id="result_box" lang="hu"><span>Amire szükséged lesz a megértéshez</span></span></h2>
+
+<p><span id="result_box" lang="hu"><span>Ez az útmutató</span> <span>feltételezi, hogy</span> <span>a</span> <span>következő alapvető</span> <span>háttérrel rendelkezel</span><span>:</span></span></p>
+
+<ul>
+ <li><span id="result_box" lang="hu"><span>Általános</span> <span>ismeret az internet</span> <span>és a World</span> <span>Wide</span> <span>Web</span></span> ({{Glossary("WWW")}}) működéséről.</li>
+ <li><span class="short_text" id="result_box" lang="hu"><span class="alt-edited">Megfelelő gyakorlati ismeretek a</span></span> HyperText Markup Language, az az ({{Glossary("HTML")}}) nyelvet kapcsolatban.</li>
+ <li><span id="result_box" lang="hu"><span>Alapszintű</span> <span>programozási tapasztalat</span><span>.</span> <span class="alt-edited">Amennyiben</span> <span>kezdő</span> <span>programozó vagy,</span> <span class="alt-edited">akkor próbálkozz meg az</span> <span class="alt-edited">oktatóanyagokkal a</span><span> fő oldalon</span> </span><a href="/en-US/docs/Web/JavaScript">JavaScript</a>.</li>
+</ul>
+
+<h2 id="További_információk_a_JavaScript-ről">További információk a JavaScript-ről</h2>
+
+<p><span id="result_box" lang="hu"><span>A</span> <span>JavaScript</span> <span>dokumentáció</span> <span>a következőket tartalmazza:</span></span></p>
+
+<ul>
+ <li><a href="/en-US/Learn">Tanulás az interneten</a> <span id="result_box" lang="hu"><span>információt nyújt</span> <span>a kezdőknek</span><span>, és bemutatja</span> <span>az alapvető fogalmakat</span> <span>a programozással</span> <span>és az internettel kapcsolatban.</span></span></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Guide">JavaScript Útmutató</a> (ez) <span id="result_box" lang="hu"><span>áttekintést ad</span> <span>a</span> <span>JavaScript</span> <span>nyelvhez</span><span>.</span></span></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference">JavaScript Referencia</a> <span id="result_box" lang="hu"><span>részletes</span> <span>referencia anyag</span> a <span>JavaScript</span></span>-hez.</li>
+</ul>
+
+<p>Ha kezdő JavaScript programozó vagy, akkor jó helyen jársz, a <a href="/en-US/docs/Web/JavaScript/Guide">JavaScript Útmutatóban</a> elsajátíthatod a keresett tudást. Ha már alap szinten ismered a nyelvet, egyszerűbb lehet számodra a <a href="/en-US/docs/Web/JavaScript/Reference">JavaScript Referencia</a>, ahol szakmai információkat olvashatsz.</p>
+
+<h2 id="Mi_az_a_JavaScript">Mi az a JavaScript?</h2>
+
+<p>A JavaScript egy platform független (cross-platform), objektum orientált script nyelv. Beépített környezetben fut (általában egy web böngésző), JavaScript képes kapcsolódni más objektum környezettel (DOM, lásd később), ezáltal tudja manipulálni azt.</p>
+
+<p><span id="result_box" lang="hu"><span>JavaScript</span> <span>tartalmaz</span> <span>egy szabványos</span> objektum <span>könyvtárat</span><span>,</span></span> <span id="result_box" lang="hu"><span>mint például a</span></span>z <code>Array</code>, <code>Date</code>, és <code>Math</code>, <span id="result_box" lang="hu"><span>és</span> <span>alapvető</span> <span>nyelvi</span> <span>elemeket, például az</span> operátorokat és <span>vezérlési szerkezeteket</span></span>. <span id="result_box" lang="hu"><span>JavaScript</span>-et <span>lehet bővíteni</span><span> különböző célokra</span> <span>történő kiegészítéssel, annak speciális igényeivel, p</span><span>éldául:</span></span></p>
+
+<ul>
+ <li><em>Kliens oldali JavaScript</em> <span id="result_box" lang="hu"><span>kiterjeszti</span> <span>az alapvető</span> <span>nyelvi</span> elemeket olyan <span>objektumokkal</span>, mely képes e<span>gy</span> <span>böngészőben manipulálni a </span><span>Document</span> <span>Object</span> <span>Model-t</span> <span>(</span><span>HTML DOM)</span></span>. <span id="result_box" lang="hu"><span>Például</span><span>, </span></span> <span id="result_box" lang="hu"><span>lehetővé teszi</span></span><span lang="hu"><span>, </span></span>hogy <span id="result_box" lang="hu"><span>egy HTML űrlapon </span></span><span lang="hu"><span>reagál a felhasználó</span>i <span>eseményekre, mint a</span> <span>kattintás vagy a</span><span> bevitt adatok ellenőrzése</span><span>.</span></span></li>
+ <li><em>Szerver oldali JavaScript</em> <span id="result_box" lang="hu"><span>kiterjeszti</span> <span>az alapvető</span> <span>nyelvi</span> elemeket olyan <span>objektumokkal</span>, mely érdemessé teszi, hogy fusson egy szerveren</span>. <span id="result_box" lang="hu"><span>Például</span><span>,</span></span> <span id="result_box" lang="hu"><span>lehetővé teszi</span></span><span lang="hu"><span>, </span></span>hogy <span id="result_box" lang="hu"><span>kommunikáljon</span> egy <span>adatbázissal</span>, <span>vagy</span> <span>végezhessen fájl</span><span>manipulációkat</span> <span>a szerveren</span><span>.</span></span></li>
+</ul>
+
+<h2 id="JavaScript_and_Java" name="JavaScript_and_Java">JavaScript and Java</h2>
+
+<p>JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.</p>
+
+<p>In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.</p>
+
+<p>JavaScript is a very free-form language compared to Java. You do not have to declare all variables, classes, and methods. You do not have to be concerned with whether methods are public, private, or protected, and you do not have to implement interfaces. Variables, parameters, and function return types are not explicitly typed.</p>
+
+<p>Java is a class-based programming language designed for fast execution and type safety. Type safety means, for instance, that you can't cast a Java integer into an object reference or access private memory by corrupting Java bytecodes. Java's class-based model means that programs consist exclusively of classes and their methods. Java's class inheritance and strong typing generally require tightly coupled object hierarchies. These requirements make Java programming more complex than JavaScript programming.</p>
+
+<p>In contrast, JavaScript descends in spirit from a line of smaller, dynamically typed languages such as HyperTalk and dBASE. These scripting languages offer programming tools to a much wider audience because of their easier syntax, specialized built-in functionality, and minimal requirements for object creation.</p>
+
+<table class="standard-table">
+ <caption>JavaScript compared to Java</caption>
+ <thead>
+ <tr>
+ <th scope="col">JavaScript</th>
+ <th scope="col">Java</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Object-oriented. No distinction between types of objects. Inheritance is through the prototype mechanism, and properties and methods can be added to any object dynamically.</td>
+ <td>Class-based. Objects are divided into classes and instances with all inheritance through the class hierarchy. Classes and instances cannot have properties or methods added dynamically.</td>
+ </tr>
+ <tr>
+ <td>Variable data types are not declared (dynamic typing).</td>
+ <td>Variable data types must be declared (static typing).</td>
+ </tr>
+ <tr>
+ <td>Cannot automatically write to hard disk.</td>
+ <td>Can automatically write to hard disk.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>For more information on the differences between JavaScript and Java, see the chapter <a href="/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model">Details of the object model</a>.</p>
+
+<h2 id="JavaScript_and_the_ECMAScript_Specification" name="JavaScript_and_the_ECMAScript_Specification">JavaScript and the ECMAScript specification</h2>
+
+<p>JavaScript is standardized at <a class="external" href="http://www.ecma-international.org/">Ecma International</a> — the European association for standardizing information and communication systems (ECMA was formerly an acronym for the European Computer Manufacturers Association) to deliver a standardized, international programming language based on JavaScript. This standardized version of JavaScript, called ECMAScript, behaves the same way in all applications that support the standard. Companies can use the open standard language to develop their implementation of JavaScript. The ECMAScript standard is documented in the ECMA-262 specification. See <a href="/en-US/docs/Web/JavaScript/New_in_JavaScript">New in JavaScript</a> to learn more about different versions of JavaScript and ECMAScript specification editions.</p>
+
+<p>The ECMA-262 standard is also approved by the <a class="external" href="http://www.iso.ch/">ISO</a> (International Organization for Standardization) as ISO-16262. You can also find the specification on <a class="external" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">the Ecma International website</a>. The ECMAScript specification does not describe the Document Object Model (DOM), which is standardized by the <a class="external" href="http://www.w3.org/">World Wide Web Consortium (W3C)</a> and/or <a href="https://whatwg.org">WHATWG (Web Hypertext Application Technology Working Group)</a>. The DOM defines the way in which HTML document objects are exposed to your script. To get a better idea about the different technologies that are used when programming with JavaScript, consult the article <a href="/en-US/docs/Web/JavaScript/JavaScript_technologies_overview">JavaScript technologies overview</a>.</p>
+
+<h3 id="JavaScript_Documentation_versus_the_ECMAScript_Specification" name="JavaScript_Documentation_versus_the_ECMAScript_Specification">JavaScript documentation versus the ECMAScript specification</h3>
+
+<p>The ECMAScript specification is a set of requirements for implementing ECMAScript; it is useful if you want to implement standards-compliant language features in your ECMAScript implementation or engine (such as SpiderMonkey in Firefox, or v8 in Chrome).</p>
+
+<p>The ECMAScript document is not intended to help script programmers; use the JavaScript documentation for information on writing scripts.</p>
+
+<p>The ECMAScript specification uses terminology and syntax that may be unfamiliar to a JavaScript programmer. Although the description of the language may differ in ECMAScript, the language itself remains the same. JavaScript supports all functionality outlined in the ECMAScript specification.</p>
+
+<p>The JavaScript documentation describes aspects of the language that are appropriate for a JavaScript programmer.</p>
+
+<h2 id="Getting_started_with_JavaScript">Getting started with JavaScript</h2>
+
+<p>Getting started with JavaScript is easy: all you need is a modern Web browser. This guide includes some JavaScript features which are only currently available in the latest versions of Firefox, so using the most recent version of Firefox is recommended.</p>
+
+<p>There are two tools built into Firefox that are useful for experimenting with JavaScript: the Web Console and Scratchpad.</p>
+
+<h3 id="The_Web_Console">The Web Console</h3>
+
+<p>The <a href="/en-US/docs/Tools/Web_Console">Web Console</a> shows you information about the currently loaded Web page, and also includes a <a href="/en-US/docs/Tools/Web_Console#The_command_line_interpreter">command line</a> that you can use to execute JavaScript expressions in the current page.</p>
+
+<p>To open the Web Console (Ctrl+Shift+K), select "Web Console" from the "Developer" menu, which is under the "Tools" menu in Firefox. It appears at the bottom of the browser window. Along the bottom of the console is a command line that you can use to enter JavaScript, and the output appears in the pane above:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/7363/web-console-commandline.png" style="display: block; margin-left: auto; margin-right: auto;"></p>
+
+<h3 id="Scratchpad">Scratchpad</h3>
+
+<p>The Web Console is great for executing single lines of JavaScript, but although you can execute multiple lines, it's not very convenient for that, and you can't save your code samples using the Web Console. So for more complex examples <a href="/en-US/docs/Tools/Scratchpad">Scratchpad</a> is a better tool.</p>
+
+<p>To open Scratchpad (Shift+F4), select "Scratchpad" from the "Developer" menu, which is under the menu in Firefox. It opens in a separate window and is an editor that you can use to write and execute JavaScript in the browser. You can also save scripts to disk and load them from disk.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/7365/scratchpad.png" style="display: block; margin-left: auto; margin-right: auto;"></p>
+
+<h3 id="Hello_world">Hello world</h3>
+
+<p>To get started with writing JavaScript, open the Scratchpad and write your first "Hello world" JavaScript code:</p>
+
+<pre class="brush: js">function greetMe(yourName) {
+ alert("Hello " + yourName);
+}
+
+greetMe("World");
+</pre>
+
+<p>Select the code in the pad and hit Ctrl+R to watch it unfold in your browser!</p>
+
+<p>In the following pages, this guide will introduce you to the JavaScript syntax and language features, so that you will be able to write more complex applications.</p>
+
+<p>{{PreviousNext("Web/JavaScript/Guide", "Web/JavaScript/Guide/Grammar_and_types")}}</p>