Skip to content

Commit f0c7ed2

Browse files
authored
Merge pull request #114 from javascript-tutorial/sync-8d9ecb72
Sync with upstream @ 8d9ecb7
2 parents cd5180c + 92f741b commit f0c7ed2

File tree

13 files changed

+70
-128
lines changed

13 files changed

+70
-128
lines changed

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

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,15 @@ n = 12.345;
4848
alert( "not a number" / 2 ); // NaN, μια τέτοια διαίρεση είναι εσφαλμένη
4949
```
5050

51-
<<<<<<< HEAD
5251
`NaN` είναι sticky. Οποιαδήποτε περαιτέρω λειτουργία στο `NaN` επιστρέφει `NaN`:
53-
=======
54-
`NaN` is sticky. Any further mathematical operation on `NaN` returns `NaN`:
55-
>>>>>>> 2cca9a9d09fdd45819832294225aa3721fa5a2d4
5652

5753
```js run
5854
alert( NaN + 1 ); // NaN
5955
alert( 3 * NaN ); // NaN
6056
alert( "not a number" / 2 - 1 ); // NaN
6157
```
6258

63-
<<<<<<< HEAD
6459
Έτσι, εάν υπάρχει ένα `NaN` κάπου σε μια μαθηματική έκφραση, μεταδίδεται σε ολόκληρο το αποτέλεσμα.
65-
=======
66-
So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result (there's only one exception to that: `NaN ** 0` is `1`).
67-
>>>>>>> 2cca9a9d09fdd45819832294225aa3721fa5a2d4
6860

6961
```smart header="Mathematical operations are safe"
7062
Το να κάνουμε μαθηματικά είναι "ασφαλές" στην JavaScript. Μπορούμε να κάνουμε οτιδήποτε: διαίρεση με μηδέν, αντιμετωπίζουμε μη αριθμητικές συμβολοσειρές ως αριθμούς κ.λπ.
@@ -78,27 +70,9 @@ n = 12.345;
7870

7971
## BigInt [#bigint-type]
8072

81-
<<<<<<< HEAD
8273
Στην JavaScript, ο τύπου "αριθμός" δεν μπορεί να αντιπροσωπεύει ακέραιες τιμές μεγαλύτερες από <code>2<sup>53</sup></code> (`9007199254740991`) (ή μικρότερες από <code>-2<sup>53</sup></code> για αρνητικά), αυτός είναι ένας τεχνικός περιορισμός που προκαλείται από την εσωτερική τους αναπαράσταση.
8374

84-
8575
Οπότε για τους περισσότερους σκοπούς ο περιορισμός δεν αποτελεί πρόβλημα, αλλά μερικές φορές χρειαζόμαστε πολύ μεγάλους αριθμούς, π.χ. για cryptography ή microsecond-precision timestamps.
86-
=======
87-
In JavaScript, the "number" type cannot safely represent integer values larger than <code>(2<sup>53</sup>-1)</code> (that's `9007199254740991`), or less than <code>-(2<sup>53</sup>-1)</code> for negatives.
88-
89-
To be really precise, the "number" type can store larger integers (up to <code>1.7976931348623157 * 10<sup>308</sup></code>), but outside of the safe integer range <code>±(2<sup>53</sup>-1)</code> there'll be a precision error, because not all digits fit into the fixed 64-bit storage. So an "approximate" value may be stored.
90-
91-
For example, these two numbers (right above the safe range) are the same:
92-
93-
```js
94-
console.log(9007199254740991 + 1); // 9007199254740992
95-
console.log(9007199254740991 + 2); // 9007199254740992
96-
```
97-
98-
So to say, all odd integers greater than <code>(2<sup>53</sup>-1)</code> can't be stored at all in the "number" type.
99-
100-
For most purposes <code>±(2<sup>53</sup>-1)</code> range is quite enough, but sometimes we need the entire range of really big integers, e.g. for cryptography or microsecond-precision timestamps.
101-
>>>>>>> 7000ede297bfd688f9a3767e8ca43abd9242f322
10276

10377
Ο τύπου `BigInt` προστέθηκε πρόσφατα στη γλώσσα για να αντιπροσωπεύει ακέραιους αριθμούς αυθαίρετου μήκους.
10478

@@ -283,7 +257,6 @@ typeof alert // "function" (3)
283257

284258
Υπάρχουν 8 βασικοί τύποι δεδομένων στην JavaScript.
285259

286-
<<<<<<< HEAD
287260
- `number` για αριθμούς οποιουδήποτε είδους: ακέραιος ή floating-point, οι ακέραιοι αριθμοί περιορίζονται κατά ±2<sup>53</sup>.
288261
- `bigint` είναι για ακέραιους αριθμούς αυθαίρετου μήκους.
289262
- `string` για συμβολοσειρές. Μια συμβολοσειρά μπορεί να έχει έναν ή περισσότερους χαρακτήρες, δεν υπάρχει ξεχωριστός τύπος ενός χαρακτήρα.
@@ -292,18 +265,7 @@ typeof alert // "function" (3)
292265
- `undefined` για μη εκχωρημένες τιμές - έναν αυτόνομο τύπο που έχει μία μόνο τιμή `undefined`.
293266
- `object` για πιο περίπλοκες δομές δεδομένων.
294267
- `symbol` για μοναδικούς identifiers.
295-
=======
296-
- Seven primitive data types:
297-
- `number` for numbers of any kind: integer or floating-point, integers are limited by <code>±(2<sup>53</sup>-1)</code>.
298-
- `bigint` for integer numbers of arbitrary length.
299-
- `string` for strings. A string may have zero or more characters, there's no separate single-character type.
300-
- `boolean` for `true`/`false`.
301-
- `null` for unknown values -- a standalone type that has a single value `null`.
302-
- `undefined` for unassigned values -- a standalone type that has a single value `undefined`.
303-
- `symbol` for unique identifiers.
304-
- And one non-primitive data type:
305-
- `object` for more complex data structures.
306-
>>>>>>> 30a5d5e2a7c3504c9afd5028f83f4a696e60aede
268+
307269

308270
Ο τελεστής `typeof` μας επιτρέπει να δούμε ποιος τύπος αποθηκεύεται σε μια μεταβλητή.
309271

1-js/02-first-steps/08-operators/article.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
```js run
5252
alert( 5 % 2 ); // 1, ένα υπόλοιπο 5 διαιρούμενο με 2
5353
alert( 8 % 3 ); // 2, ένα υπόλοιπο 8 διαιρούμενο με 3
54+
alert( 8 % 4 ); // 3, ένα υπόλοιπο 8 διαιρούμενο με 4
5455
```
5556

5657
### Εκθετικό **
@@ -67,7 +68,6 @@ alert( 2 ** 4 ); // 16 (2 * 2 * 2 * 2, 4 φορές)
6768

6869
Μαθηματικά, ο εκθετικός ορίζεται και για μη ακέραιους αριθμούς. Για παράδειγμα, μια τετραγωνική ρίζα εκτείνεται με το `1/2`:
6970

70-
7171
```js run
7272
alert( 4 ** (1/2) ); // 2 (η ισχύς του 1/2 είναι η ίδια με μια τετραγωνική ρίζα)
7373
alert( 8 ** (1/3) ); // 2 (η ισχύς του 1/3 είναι η ίδια με μια τετραγωνική ρίζα)
@@ -77,11 +77,7 @@ alert( 8 ** (1/3) ); // 2 (η ισχύς του 1/3 είναι η ίδια με
7777

7878
Ας συναντήσουμε τις δυνατότητες των τελεστών JavaScript που είναι πέρα από τη σχολική αριθμητική.
7979

80-
<<<<<<< HEAD
8180
Συνήθως, ο τελεστής συν `+` αθροίζει τους αριθμούς
82-
=======
83-
Let's meet the features of JavaScript operators that are beyond school arithmetics.
84-
>>>>>>> 5dff42ba283bce883428c383c080fa9392b71df8
8581

8682
Όμως, εάν το δυαδικό `+` εφαρμόζεται σε συμβολοσειρές, τα συγχωνεύει:
8783

@@ -304,6 +300,8 @@ n *= 3 + 5; // right part evaluated first, same as n *= 8
304300
305301
alert( n ); // 16 (το σωστό μέρος αξιολογήθηκε πρώτα, το ίδια και για το n *= 8)
306302
303+
```
304+
307305
## Αύξηση/μείωση
308306

309307
<!-- Can't use -- in title, because the built-in parser turns it into a 'long dash' – -->
@@ -411,7 +409,6 @@ let counter = 1;
411409
alert( 2 * counter );
412410
counter++;
413411
```
414-
````
415412
416413
## Τελεστές Bitwise
417414

1-js/02-first-steps/12-nullish-coalescing-operator/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ alert(user ?? "Anonymous"); // Anonymous (user is undefined)
3232
```js run
3333
let user = "John";
3434

35-
alert(user ?? "Anonymous"); // John (user is not null/udefined)
35+
alert(user ?? "Anonymous"); // John (user is not null/undefined)
3636
```
3737
3838
Μπορούμε επίσης να χρησιμοποιήσουμε μια ακολουθία του `??` για να επιλέξουμε την πρώτη τιμή από μια λίστα που δεν είναι `null/undefined`.

1-js/04-object-basics/09-object-toprimitive/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ As we know already, many operators and functions perform type conversions, e.g.
226226

227227
If we pass an object as an argument, then there are two stages of calculations:
228228
1. The object is converted to a primitive (using the rules described above).
229-
2. If the necessary for further calculations, the resulting primitive is also converted.
229+
2. If necessary for further calculations, the resulting primitive is also converted.
230230

231231
For instance:
232232

1-js/05-data-types/03-string/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ This method actually has two additional arguments specified in [the documentatio
505505
506506
- There are 3 types of quotes. Backticks allow a string to span multiple lines and embed expressions `${…}`.
507507
- We can use special characters, such as a line break `\n`.
508-
- To get a character, use: `[]`.
508+
- To get a character, use: `[]` or `at` method.
509509
- To get a substring, use: `slice` or `substring`.
510510
- To lowercase/uppercase a string, use: `toLowerCase/toUpperCase`.
511511
- To look for a substring, use: `indexOf`, or `includes/startsWith/endsWith` for simple checks.
@@ -519,4 +519,4 @@ There are several other helpful methods in strings:
519519
520520
Strings also have methods for doing search/replace with regular expressions. But that's big topic, so it's explained in a separate tutorial section <info:regular-expressions>.
521521
522-
Also, as of now it's important to know that strings are based on Unicode encoding, and hence there're issues with comparisons. There's more about Unicode in the chapter <info:unicode>.
522+
Also, as of now it's important to know that strings are based on Unicode encoding, and hence there're issues with comparisons. There's more about Unicode in the chapter <info:unicode>.

0 commit comments

Comments
 (0)