Skip to content

Commit 068eb89

Browse files
committed
1-js/02-first-steps/05-types
1 parent 398a7f2 commit 068eb89

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

1-js/02-first-steps/05-types/article.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,20 @@ Tipul `object` este special.
178178

179179
Toate celelalte tipuri sunt numite "primitive", pentru că valorile lor pot conține doar un singur lucru (fie un string sau un număr sau orice altceva). În contrast, obiectele sunt folosite pentru a stoca colecții de date și entități mult mai complexe. Vom avea de aface cu ele mai târziu, în capitolul <info:object>, după ce aflăm mai multe despre primitive.
180180

181-
The `symbol` type is used to create unique identifiers for objects. We have to mention it here for completeness, but it's better to study them after objects.
181+
Tipul `symbol` este folosit pentru a creea identificatori unici pentru obiecte. Trebuie să menționăm aici pentru completitudine, dar este mai bine să le studiezi după obiecte.
182182

183-
## The typeof operator [#type-typeof]
183+
## Operatorul typeof [#type-typeof]
184184

185-
The `typeof` operator returns the type of the argument. It's useful when we want to process values of different types differently, or just want to make a quick check.
185+
Operatorul `typeof` returnează tipul argumentului. Este folositor atunci când vrem să procesăm valori de tipuri diferite, în mod diferit, sau doar vrem să facem o verificare rapidă.
186186

187-
It supports two forms of syntax:
187+
Suportă două forme de sintaxă:
188188

189-
1. As an operator: `typeof x`.
190-
2. Function style: `typeof(x)`.
189+
1. Ca și operator: `typeof x`.
190+
2. Ca funcție: `typeof(x)`.
191191

192-
In other words, it works both with parentheses or without them. The result is the same.
192+
Cu alte cuvinte funcționează cu sau fără paranteze. Rezultatul este același.
193193

194-
The call to `typeof x` returns a string with the type name:
194+
Apelul lui `typeof x` returnează un string cu numele tipului:
195195

196196
```js
197197
typeof undefined // "undefined"
@@ -217,29 +217,29 @@ typeof alert // "function" (3)
217217
*/!*
218218
```
219219

220-
The last three lines may need additional explanations:
220+
Ultimele trei linii ar putea avea nevoie de explicații adiționale:
221221

222-
1. `Math` is a built-in object that provides mathematical operations. We will learn it in the chapter <info:number>. Here it serves just as an example of an object.
223-
2. The result of `typeof null` is `"object"`. That's wrong. It is an officially recognized error in `typeof`, kept for compatibility. Of course, `null` is not an object. It is a special value with a separate type of its own. So, again, that's an error in the language.
224-
3. The result of `typeof alert` is `"function"`, because `alert` is a function of the language. We'll study functions in the next chapters, and we'll see that there's no special "function" type in the language. Functions belong to the object type. But `typeof` treats them differently. Formally, it's incorrect, but very convenient in practice.
222+
1. `Math` este un obiect built-in (încorporat) care furnizează operații matematice. Îl vom învăța în capitolul <info:number>. Aici servește doar ca și exemplu de obiect.
223+
2. Rezultatul lui `typeof null` este `"object"`. Ceea ce este greșit. Este o eroare recunoscută oficial a lui `typeof`, păstrată pentru compatibilitate. Desigur, `null` nu este un obiect. Este o valoare specială cu un tip separat al său. Așadar, din nou, Aceasta este o eroare a limbajului.
224+
3. Rezultatul lui `typeof alert` este `"function"`, pentru că `alert` este o funcție a limbajului. Vom studia funcțiile în capitolul următor și vom vedea că nu există nici o funcție specială pe nume "function", în limbaj. Funcțiile aparțin tipului obiect. Dar `typeof` le tratează în mod diferit. Din punct de vedere formal este incorect, dar este foarte convenabil în practică.
225225

226226

227-
## Summary
227+
## Rezumat
228228

229-
There are 7 basic types in JavaScript.
229+
Există 7 tipuri de bază în JavaScrit.
230230

231-
- `number` for numbers of any kind: integer or floating-point.
232-
- `string` for strings. A string may have one or more characters, there's no separate single-character type.
233-
- `boolean` for `true`/`false`.
234-
- `null` for unknown values -- a standalone type that has a single value `null`.
235-
- `undefined` for unassigned values -- a standalone type that has a single value `undefined`.
236-
- `object` for more complex data structures.
237-
- `symbol` for unique identifiers.
231+
- `number` pentru numere de orice gen: întregi sau reale.
232+
- `string` pentru string-uri. Un string poate avea unul sau mai multe caractere, nu există niciun tip separat pentru un singur caracter.
233+
- `boolean` pentru `true`/`false`.
234+
- `null` pentru valori necunoscute -- un tip de sine stătător, care are o singură valoare, `null`.
235+
- `undefined` pentru valori neasignate -- un tip de sine stătător care are o singură valoare, `undefined`.
236+
- `object` pentru structuri de date mai complexe.
237+
- `symbol` pentru identificatori unici.
238238

239-
The `typeof` operator allows us to see which type is stored in the variable.
239+
Operatorul `typeof` ne permite să vedem ce tip este stocat în variabilă.
240240

241-
- Two forms: `typeof x` or `typeof(x)`.
242-
- Returns a string with the name of the type, like `"string"`.
243-
- For `null` returns `"object"` -- that's an error in the language, it's not an object in fact.
241+
- Două forme: `typeof x` sau `typeof(x)`.
242+
- Returnează un string cu numele tipului, precum `"string"`.
243+
- Pentru `null` returnează `"object"` -- aceasta este o eroare în limbaj, nu este un obiect, defapt.
244244

245-
In the next chapters we'll concentrate on primitive values and once we're familiar with them, then we'll move on to objects.
245+
În următoarele capitole ne vom concentra pe valorile primitive și odată ce suntem familiarizați cu ele, vom trece la obiecte.

0 commit comments

Comments
 (0)