You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/05-types/article.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,20 +178,20 @@ Tipul `object` este special.
178
178
179
179
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.
180
180
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.
182
182
183
-
## The typeof operator[#type-typeof]
183
+
## Operatorul typeof [#type-typeof]
184
184
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ă.
186
186
187
-
It supports two forms of syntax:
187
+
Suportă două forme de sintaxă:
188
188
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)`.
191
191
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.
193
193
194
-
The call to `typeof x`returns a string with the type name:
194
+
Apelul lui `typeof x`returnează un string cu numele tipului:
The last three lines may need additional explanations:
220
+
Ultimele trei linii ar putea avea nevoie de explicații adiționale:
221
221
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ă.
225
225
226
226
227
-
## Summary
227
+
## Rezumat
228
228
229
-
There are 7 basic types in JavaScript.
229
+
Există 7 tipuri de bază în JavaScrit.
230
230
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.
238
238
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ă.
240
240
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.
244
244
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