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/2-manuals-specifications/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ This book is a *tutorial*. It aims to help you gradually learn the language. But
5
5
6
6
## Specification
7
7
8
-
**The ECMA-262 specification** contains the most in-depth, detailed and formalized information about JavaScript. It defines the language.
8
+
[The ECMA-262 specification](https://www.ecma-international.org/publications/standards/Ecma-262.htm) contains the most in-depth, detailed and formalized information about JavaScript. It defines the language.
9
9
10
10
But being that formalized, it's difficult to understand at first. So if you need the most trustworthy source of information about the language details, the specification is the right place. But it's not for everyday use.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ true + false = 1
14
14
" -9 "-5=-14// (4)
15
15
null+1=1// (5)
16
16
undefined+1=NaN// (6)
17
+
"\t\n"-2=-2// (7)
17
18
```
18
19
19
20
1. The addition with a string `"" + 1` converts `1` to a string: `"" + 1 = "1"`, and then we have `"1" + 0`, the same rule is applied.
@@ -22,3 +23,4 @@ undefined + 1 = NaN // (6)
22
23
4. The subtraction always converts to numbers, so it makes `" -9 "` a number `-9` (ignoring spaces around it).
23
24
5.`null` becomes `0` after the numeric conversion.
24
25
6.`undefined` becomes `NaN` after the numeric conversion.
26
+
7. Space characters, are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/06-type-conversions/article.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ There are also cases when we need to explicitly convert a value to the expected
10
10
In this chapter, we won't cover objects. Instead, we'll study primitives first. Later, after we learn about objects, we'll see how object conversion works in the chapter <info:object-toprimitive>.
11
11
```
12
12
13
-
## ToString
13
+
## To String
14
14
15
15
String conversion happens when we need the string form of a value.
16
16
@@ -30,7 +30,7 @@ alert(typeof value); // string
30
30
31
31
String conversion is mostly obvious. A `false` becomes `"false"`, `null` becomes `"null"`, etc.
32
32
33
-
## ToNumber
33
+
## To Number
34
34
35
35
Numeric conversion happens in mathematical functions and expressions automatically.
36
36
@@ -94,7 +94,7 @@ alert( '1' + 2 ); // '12' (string to the left)
94
94
This only happens when at least one of the arguments is a string. Otherwise, values are converted to numbers.
95
95
````
96
96
97
-
## ToBoolean
97
+
## To Boolean
98
98
99
99
Boolean conversion is the simplest one.
100
100
@@ -129,9 +129,9 @@ alert( Boolean(" ") ); // spaces, also true (any non-empty string is true)
129
129
130
130
The three most widely used type conversions are to string, to number, and to boolean.
131
131
132
-
**`ToString`** -- Occurs when we output something. Can be performed with `String(value)`. The conversion to string is usually obvious for primitive values.
132
+
**`To String`** -- Occurs when we output something. Can be performed with `String(value)`. The conversion to string is usually obvious for primitive values.
133
133
134
-
**`ToNumber`** -- Occurs in math operations. Can be performed with `Number(value)`.
134
+
**`To Number`** -- Occurs in math operations. Can be performed with `Number(value)`.
135
135
136
136
The conversion follows the rules:
137
137
@@ -142,7 +142,7 @@ The conversion follows the rules:
142
142
|<code>true / false</code> | `1 / 0` |
143
143
| `string` | The string is read "as is", whitespaces from both sides are ignored. An empty string becomes `0`. An error gives `NaN`. |
144
144
145
-
**`ToBoolean`** -- Occurs in logical operations. Can be performed with `Boolean(value)`.
145
+
**`To Boolean`** -- Occurs in logical operations. Can be performed with `Boolean(value)`.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/07-operators/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Before we move on, let's grasp some common terminology.
26
26
alert( y - x ); // 2, binary minus subtracts values
27
27
```
28
28
29
-
Formally, we're talking about two different operators here: the unary negation (single operand: reverses the sign) and the binary subtraction (two operands: subtracts).
29
+
Formally, in the examples above we have two different operators that share the same symbol: the negation operator, a unary operator that reverses the sign, and the subtraction operator, a binary operator that subtracts one number from another.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/16-javascript-specials/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,7 +149,7 @@ Conditional
149
149
: The only operator with three parameters: `cond ? resultA : resultB`. If `cond` is truthy, returns `resultA`, otherwise `resultB`.
150
150
151
151
Logical operators
152
-
: Logical AND `&&` and OR `||` perform short-circuit evaluation and then return the value where it stopped. Logical NOT `!` converts the operand to boolean type and returns the inverse value.
152
+
: Logical AND `&&` and OR `||` perform short-circuit evaluation and then return the value where it stopped (not necessary `true`/`false`). Logical NOT `!` converts the operand to boolean type and returns the inverse value.
153
153
154
154
Comparisons
155
155
: Equality check `==` for values of different types converts them to a number (except `null` and `undefined` that equal each other and nothing else), so these are equal:
Copy file name to clipboardExpand all lines: 1-js/03-code-quality/06-polyfills/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Here Babel comes to the rescue.
19
19
20
20
Actually, there are two parts in Babel:
21
21
22
-
1. First, the transpiler program, which rewrites the code. The developer runs it on their own computer. It rewrites the code into the older standard. And then the code is delivered to the website for users. Modern project build system like [webpack](http://webpack.github.io/) provide means to run transpiler automatically on every code change, so that very easy to integrate into development process.
22
+
1. First, the transpiler program, which rewrites the code. The developer runs it on their own computer. It rewrites the code into the older standard. And then the code is delivered to the website for users. Modern project build systems like [webpack](http://webpack.github.io/) provide means to run transpiler automatically on every code change, so that very easy to integrate into development process.
0 commit comments