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/01-getting-started/1-intro/article.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,8 +41,13 @@ Engines are complicated. But the basics are easy.
41
41
2. Then it converts ("compiles") the script to the machine language.
42
42
3. And then the machine code runs, pretty fast.
43
43
44
+
<<<<<<< HEAD
44
45
The engine applies optimizations at each step of the process. It even watches the compiled script as it runs, analyzes the data that flows through it, and applies optimizations to the machine code based on that knowledge. When it's done, scripts run quite fast.
45
46
'''
47
+
=======
48
+
The engine applies optimizations at each step of the process. It even watches the compiled script as it runs, analyzes the data that flows through it, and further optimizes the machine code based on that knowledge.
49
+
```
50
+
>>>>>>> fcfef6a07842ed56144e04a80c3a24de049a952a
46
51
47
52
## What can in-browser JavaScript do?
48
53
@@ -66,7 +71,7 @@ JavaScript's abilities in the browser are limited for the sake of the user's saf
66
71
67
72
Examples of such restrictions include:
68
73
69
-
- JavaScript on a webpage may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS system functions.
74
+
- JavaScript on a webpage may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS functions.
70
75
71
76
Modern browsers allow it to work with files, but the access is limited and only provided if the user does certain actions, like "dropping" a file into a browser window or selecting it via an '<input>' tag.
Copy file name to clipboardExpand all lines: 1-js/01-getting-started/4-devtools/article.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,11 @@
33
33
34
34
Τώρα μπορούμε να δούμε λάθη, και αυτό είναι αρκετό για μια αρχή. Θα επιστρέψουμε αργότερα στα developer tools και θα καλύψουμε λεπτομερέστερα το σφάλμα στο κεφάλαιο <info:debugging-chrome>.
35
35
36
+
```smart header="Multi-line input"
37
+
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
38
+
39
+
To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/02-structure/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ But it should be two separate statements, not one. Such a merging in this case i
94
94
95
95
We recommend putting semicolons between statements even if they are separated by newlines. This rule is widely adopted by the community. Let's note once again -- *it is possible* to leave out semicolons most of the time. But it's safer -- especially for a beginner -- to use them.
96
96
97
-
## Comments
97
+
## Comments[#code-comments]
98
98
99
99
As time goes on, programs become more and more complex. It becomes necessary to add *comments* which describe what the code does and why.
100
100
@@ -136,7 +136,7 @@ alert('World');
136
136
```
137
137
138
138
```smart header="Use hotkeys!"
139
-
In most editors, a line of code can be commented out by pressing the `key:Ctrl+/` hotkey for a single-line comment and something like `key:Ctrl+Shift+/` -- for multiline comments (select a piece of code and press the hotkey). For Mac, try `key:Cmd` instead of `key:Ctrl`.
139
+
In most editors, a line of code can be commented out by pressing the `key:Ctrl+/` hotkey for a single-line comment and something like `key:Ctrl+Shift+/` -- for multiline comments (select a piece of code and press the hotkey). For Mac, try `key:Cmd` instead of `key:Ctrl` and `key:Option` instead of `key:Shift`.
140
140
```
141
141
142
142
````warn header="Nested comments are not supported!"
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/05-types/article.md
+31-10Lines changed: 31 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ message = 123456;
10
10
11
11
Programming languages that allow such things are called "dynamically typed", meaning that there are data types, but variables are not bound to any of them.
12
12
13
-
There are seven basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.
13
+
There are eight basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.
14
14
15
-
## A number
15
+
## Number
16
16
17
17
```js
18
18
let n =123;
@@ -62,14 +62,33 @@ Special numeric values formally belong to the "number" type. Of course they are
62
62
63
63
We'll see more about working with numbers in the chapter <info:number>.
64
64
65
-
## A string
65
+
## BigInt
66
+
67
+
In JavaScript, the "number" type cannot represent integer values larger than <code>2<sup>53</sup></code> (or less than <code>-2<sup>53</sup></code> for negatives), that's a technical limitation caused by their internal representation. That's about 16 decimal digits, so for most purposes the limitation isn't a problem, but sometimes we need really big numbers, e.g. for cryptography or microsecond-precision timestamps.
68
+
69
+
`BigInt` type was recently added to the language to represent integers of arbitrary length.
70
+
71
+
A `BigInt` is created by appending `n` to the end of an integer literal:
@@ -223,12 +244,12 @@ The last three lines may need additional explanation:
223
244
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, this is an error in the language.
224
245
3. The result of `typeof alert` is `"function"`, because `alert` is a function. We'll study functions in the next chapters where we'll also see that there's no special "function" type in JavaScript. Functions belong to the object type. But `typeof` treats them differently, returning `"function"`. That's not quite correct, but very convenient in practice.
225
246
226
-
227
247
## Summary
228
248
229
-
There are 7 basic data types in JavaScript.
249
+
There are 8 basic data types in JavaScript.
230
250
231
-
-`number` for numbers of any kind: integer or floating-point.
251
+
-`number` for numbers of any kind: integer or floating-point, integers are limited by ±2<sup>53</sup>.
252
+
-`bigint` is for integer numbers of arbitrary length.
232
253
-`string` for strings. A string may have one or more characters, there's no separate single-character type.
233
254
-`boolean` for `true`/`false`.
234
255
-`null` for unknown values -- a standalone type that has a single value `null`.
Σχεδόν όλες οι Μαθηματικές πράξεις μετατρέπουν τιμές σε αριθμούς. Μια ξεχωριστή εξαίρεση είναι ο τελεστής `+`. Έαν μία από τις προστιθέμενες τιμές είναι μια συμβολοσειρά, τότε και η άλλη μετατρέπεται σε συμβολοσειρά.
0 commit comments