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
+1-39Lines changed: 1 addition & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -48,23 +48,15 @@ n = 12.345;
48
48
alert( "not a number" / 2 ); // NaN, μια τέτοια διαίρεση είναι εσφαλμένη
49
49
```
50
50
51
-
<<<<<<<HEAD
52
51
`NaN` είναι sticky. Οποιαδήποτε περαιτέρω λειτουργία στο `NaN` επιστρέφει `NaN`:
53
-
=======
54
-
`NaN` is sticky. Any further mathematical operation on `NaN` returns `NaN`:
55
-
>>>>>>>2cca9a9d09fdd45819832294225aa3721fa5a2d4
56
52
57
53
```js run
58
54
alert( NaN + 1 ); // NaN
59
55
alert( 3 * NaN ); // NaN
60
56
alert( "not a number" / 2 - 1 ); // NaN
61
57
```
62
58
63
-
<<<<<<<HEAD
64
59
Έτσι, εάν υπάρχει ένα `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
68
60
69
61
```smart header="Mathematical operations are safe"
70
62
Το να κάνουμε μαθηματικά είναι "ασφαλές" στην JavaScript. Μπορούμε να κάνουμε οτιδήποτε: διαίρεση με μηδέν, αντιμετωπίζουμε μη αριθμητικές συμβολοσειρές ως αριθμούς κ.λπ.
@@ -78,27 +70,9 @@ n = 12.345;
78
70
79
71
## BigInt [#bigint-type]
80
72
81
-
<<<<<<<HEAD
82
73
Στην JavaScript, ο τύπου "αριθμός" δεν μπορεί να αντιπροσωπεύει ακέραιες τιμές μεγαλύτερες από <code>2<sup>53</sup></code> (`9007199254740991`) (ή μικρότερες από <code>-2<sup>53</sup></code> για αρνητικά), αυτός είναι ένας τεχνικός περιορισμός που προκαλείται από την εσωτερική τους αναπαράσταση.
83
74
84
-
85
75
Οπότε για τους περισσότερους σκοπούς ο περιορισμός δεν αποτελεί πρόβλημα, αλλά μερικές φορές χρειαζόμαστε πολύ μεγάλους αριθμούς, π.χ. για 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:
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
102
76
103
77
Ο τύπου `BigInt` προστέθηκε πρόσφατα στη γλώσσα για να αντιπροσωπεύει ακέραιους αριθμούς αυθαίρετου μήκους.
Copy file name to clipboardExpand all lines: 1-js/05-data-types/03-string/article.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -505,7 +505,7 @@ This method actually has two additional arguments specified in [the documentatio
505
505
506
506
- There are 3 types of quotes. Backticks allow a string to span multiple lines and embed expressions `${…}`.
507
507
- 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.
509
509
- To get a substring, use: `slice` or `substring`.
510
510
- To lowercase/uppercase a string, use: `toLowerCase/toUpperCase`.
511
511
- 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:
519
519
520
520
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>.
521
521
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