Skip to content

Commit c8f2582

Browse files
committed
hello, world
1 parent fec94d3 commit c8f2582

File tree

6 files changed

+51
-53
lines changed

6 files changed

+51
-53
lines changed

1-js/02-first-steps/01-hello-world/1-hello-alert/solution.view/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<body>
55

66
<script>
7-
alert( "I'm JavaScript!" );
7+
alert( "Sunt JavaScript!" );
88
</script>
99

1010
</body>

1-js/02-first-steps/01-hello-world/1-hello-alert/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ importance: 5
22

33
---
44

5-
# Show an alert
5+
# Afișați o alertă
66

7-
Create a page that shows a message "I'm JavaScript!".
7+
Creați o pagină care arată un mesaj „Sunt JavaScript!.
88

9-
Do it in a sandbox, or on your hard drive, doesn't matter, just ensure that it works.
9+
Faceți-o într-un sandbox sau pe hard disk, nu contează, doar asigurați-vă că funcționează.
1010

1111
[demo src="solution"]
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
alert("I'm JavaScript!");
1+
alert("Sunt JavaScript!");
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
The HTML code:
1+
Codul HTML:
22

33
[html src="index.html"]
44

5-
For the file `alert.js` in the same folder:
5+
Pentru fișierul `alert.js` în același folder:
66

77
[js src="alert.js"]
88

1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ importance: 5
22

33
---
44

5-
# Show an alert with an external script
5+
# Afișați o alertă cu un script extern
66

7-
Take the solution of the previous task <info:task/hello-alert>. Modify it by extracting the script content into an external file `alert.js`, residing in the same folder.
7+
Luați soluția sarcinii anterioare <info:task/hello-alert>. Modificați-o extrăgând conținutul script-ului într-un fișier extern `alert.js`, cu reședința în același folder.
88

9-
Open the page, ensure that the alert works.
9+
Deschideți pagina, asigurați-vă că funcționează alerta.
Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,84 @@
11
# Hello, world!
22

3-
This part of the tutorial is about core JavaScript, the language itself.
3+
Această parte a tutorialului este despre JavaScript de bază, limbajul în sine.
44

5-
But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial.
5+
Dar avem nevoie de un mediu pentru a rula script-urile și, având în vedere că această carte este online, browser-ul este o alegere bună. Nu o să folosim prea multe comenzi specifice browser-ului (ca `alert`) ca să nu pierdeți prea mult timp cu ele dacă vreți sa vă concentrați pe un alt mediu (ca Node.js). O să ne concentrăm pe JavaScript în browser în [urmatoarea parte](/ui) a tutorialului.
66

7-
So first, let's see how we attach a script to a webpage. For server-side environments (like Node.js), you can execute the script with a command like `"node my.js"`.
7+
În primul rând, haideți să vedem cum atașăm un script unei pagini web. Pentru mediile de dezvoltare de tipul server (ca și Node.js), se poate executa script-ul cu o comandă precum `"node my.js"`.
88

9+
## Tag-ul "script"
910

10-
## The "script" tag
11+
Programele JavaScript pot fi inserate în orice parte al unui document HTML cu ajutorul tag-ului `<script>`.
1112

12-
JavaScript programs can be inserted into any part of an HTML document with the help of the `<script>` tag.
13-
14-
For instance:
13+
De exemplu:
1514

1615
```html run height=100
1716
<!DOCTYPE HTML>
1817
<html>
1918

2019
<body>
2120

22-
<p>Before the script...</p>
21+
<p>Înainte de script...</p>
2322

2423
*!*
2524
<script>
2625
alert( 'Hello, world!' );
2726
</script>
2827
*/!*
2928

30-
<p>...After the script.</p>
29+
<p>...După script.</p>
3130

3231
</body>
3332

3433
</html>
3534
```
3635

3736
```online
38-
You can run the example by clicking the "Play" button in the right-top corner of the box above.
37+
Puteți rula exemplul dând click pe butonul „Play” din colțul din dreapta-sus al căsuței de mai sus.
3938
```
4039

41-
The `<script>` tag contains JavaScript code which is automatically executed when the browser processes the tag.
42-
40+
Tag-ul `<script>` conține cod JavaScript care este executat automat cand browser-ul procesează tag-ul.
4341

44-
## Modern markup
42+
## Markup modern
4543

46-
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
44+
Tag-ul `<script>` are câteva atribute care mai nou sunt folosite rar, dar care încă se găsesc în codul vechi:
4745

48-
The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
49-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic; we'll talk about modules in another part of the tutorial.
46+
Atributul `type`: <code>&lt;script <u>type</u>=...&gt;</code>
47+
: În vechiul standard HTML, HTML4, un script era necesar să aibă un `type`. De obicei era `type="text/javascript"`. Acum nu mai este nevoie de el. De asemenea, standardul HTML modern a schimbat total înțelesul acestui atribut. Acum, el poate fi folosit pentru module JavaScript. Dar acesta este un subiect mai avansat; o să vorbim despre module în altă parte a tutorialului.
5048

51-
The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
52-
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
49+
Atributul `language`: <code>&lt;script <u>language</u>=...&gt;</code>
50+
: Acest atribut a fost menit să arate limbajul script-ului. Acest atribut nu mai are sens deoarece JavaScript este limbajul implicit. Nu este nevoie să îl folosiți.
5351

54-
Comments before and after scripts.
55-
: In really ancient books and guides, you may find comments inside `<script>` tags, like this:
52+
Comentarii înainte și după script-uri.
53+
: În cărțile și ghidurile foarte vechi, este posibil să găsiți comentarii în interiorul tag-urilor `<script>` în felul următor:
5654

5755
```html no-beautify
5856
<script type="text/javascript"><!--
5957
...
6058
//--></script>
6159
```
6260

63-
This trick isn't used in modern JavaScript. These comments hid JavaScript code from old browsers that didn't know how to process the `<script>` tag. Since browsers released in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
64-
61+
Acest truc nu este folosit în JavaScript modern. Aceste comentarii ascund codul JavaScript în browserele vechi care nu știau cum să proceseze tag-ul `<script>`. Deoarece browserele lansate în ultimii 15 ani nu au această problemă, accest tip de comentariu vă poate ajuta să identificați cod foarte vechi.
6562

66-
## External scripts
63+
## Script-uri externe
6764

68-
If we have a lot of JavaScript code, we can put it into a separate file.
65+
Dacă avem mult cod JavaScript, putem să îl punem într-un fișier separat.
6966

70-
Script files are attached to HTML with the `src` attribute:
67+
Fișierele de acest tip sunt atașate codului HTML cu ajutorul atributului `src`:
7168

7269
```html
7370
<script src="/path/to/script.js"></script>
7471
```
7572

76-
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
73+
Aici, `/path/to/script.js` este o cale absolută către script de la rădăcina site-ului. Se poate oferi, de asemenea, o cale relativă din pagina curentă. De exemplu, `src="script.js"` ar însemna un fișier `"script.js"` în folderul curent.
7774

78-
We can give a full URL as well. For instance:
75+
Putem oferi și o adresă URL completă. De exemplu:
7976

8077
```html
8178
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.2.0/lodash.js"></script>
8279
```
8380

84-
To attach several scripts, use multiple tags:
81+
Pentru a atașa mai multe scripturi, utilizați mai multe tag-uri:
8582

8683
```html
8784
<script src="/js/script1.js"></script>
@@ -90,29 +87,29 @@ To attach several scripts, use multiple tags:
9087
```
9188

9289
```smart
93-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
90+
De regulă, doar cele mai simple script-uri sunt puse în HTML. Cele mai complexe se află în fișiere separate.
9491
95-
The benefit of a separate file is that the browser will download it and store it in its [cache](https://en.wikipedia.org/wiki/Web_cache).
92+
Avantajul unui fișier separat este că browserul îl va descărca și îl va stoca în [cache](https://en.wikipedia.org/wiki/Web_cache).
9693
97-
Other pages that reference the same script will take it from the cache instead of downloading it, so the file is actually downloaded only once.
94+
Alte pagini care fac referire la același script îl vor lua din cache în loc să-l descarce, astfel încât fișierul este descărcat efectiv o singură dată.
9895
99-
That reduces traffic and makes pages faster.
96+
Aceasta reduce traficul și face paginile mai rapide.
10097
```
10198

102-
````warn header="If `src` is set, the script content is ignored."
103-
A single `<script>` tag can't have both the `src` attribute and code inside.
99+
````warn header="Daca `src` este setat, conținutul scriptului este ignorat."
100+
Un singur tag `<script>` nu poate avea atât atributul `src` cât și codul în interior.
104101

105-
This won't work:
102+
Nu va funcționa:
106103

107104
```html
108105
<script *!*src*/!*="file.js">
109-
alert(1); // the content is ignored, because src is set
106+
alert(1); // conținutul este ignorat pentru că src este setat
110107
</script>
111108
```
112109

113-
We must choose either an external `<script src="…">` or a regular `<script>` with code.
110+
Trebuie să alegem fie un `<script src="…">` extern sau un `<script>` obișnuit cu cod.
114111

115-
The example above can be split into two scripts to work:
112+
Exemplul de mai sus poate fi împărțit în două scripturi pentru a funcționa:
116113

117114
```html
118115
<script src="file.js"></script>
@@ -122,11 +119,12 @@ The example above can be split into two scripts to work:
122119
```
123120
````
124121
125-
## Summary
122+
## Rezumat
126123
127-
- We can use a `<script>` tag to add JavaScript code to a page.
128-
- The `type` and `language` attributes are not required.
129-
- A script in an external file can be inserted with `<script src="path/to/script.js"></script>`.
124+
- Putem folosi un tag `<script>` pentru a adăuga cod JavaScript într-o pagină.
125+
- Atributele `type` și `language` nu sunt necesare.
126+
- Un script poate fi inserat într-un fișier extern cu `<script src="path/to/script.js"></script>`.
130127
131128
132-
There is much more to learn about browser scripts and their interaction with the webpage. But let's keep in mind that this part of the tutorial is devoted to the JavaScript language, so we shouldn't distract ourselves with browser-specific implementations of it. We'll be using the browser as a way to run JavaScript, which is very convenient for online reading, but only one of many.
129+
Există mult mai multe lucruri de învățat despre script-urile browser-ului și interacțiunea lor cu pagina web.
130+
Dar să reținem că această parte a tutorialului este dedicată limbajului JavaScript, deci nu trebuie să ne distragem cu implementările specifice browserului. Vom folosi browser-ul ca o modalitate de a rula JavaScript, care este foarte convenabil pentru citirea online, dar doar unul dintre mulți.

0 commit comments

Comments
 (0)