Skip to content

Commit cc50d03

Browse files
authored
Merge pull request #875 from sawyerrken/master
modified sub headings for clarity and to avoid confusion
2 parents be1746d + a30e464 commit cc50d03

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

1-js/02-first-steps/06-type-conversions/article.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ There are also cases when we need to explicitly convert a value to the expected
1010
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>.
1111
```
1212

13-
## To String
13+
## String Conversion
1414

1515
String conversion happens when we need the string form of a value.
1616

@@ -30,7 +30,7 @@ alert(typeof value); // string
3030

3131
String conversion is mostly obvious. A `false` becomes `"false"`, `null` becomes `"null"`, etc.
3232

33-
## To Number
33+
## Numeric Conversion
3434

3535
Numeric conversion happens in mathematical functions and expressions automatically.
3636

@@ -94,7 +94,7 @@ alert( '1' + 2 ); // '12' (string to the left)
9494
This only happens when at least one of the arguments is a string. Otherwise, values are converted to numbers.
9595
````
9696

97-
## To Boolean
97+
## Boolean Conversion
9898

9999
Boolean conversion is the simplest one.
100100

@@ -124,14 +124,13 @@ alert( Boolean(" ") ); // spaces, also true (any non-empty string is true)
124124
```
125125
````
126126
127-
128127
## Summary
129128
130129
The three most widely used type conversions are to string, to number, and to boolean.
131130
132-
**`To String`** -- Occurs when we output something. Can be performed with `String(value)`. The conversion to string is usually obvious for primitive values.
131+
**`String Conversion`** -- Occurs when we output something. Can be performed with `String(value)`. The conversion to string is usually obvious for primitive values.
133132
134-
**`To Number`** -- Occurs in math operations. Can be performed with `Number(value)`.
133+
**`Numeric Conversion`** -- Occurs in math operations. Can be performed with `Number(value)`.
135134
136135
The conversion follows the rules:
137136
@@ -142,7 +141,7 @@ The conversion follows the rules:
142141
|<code>true&nbsp;/&nbsp;false</code> | `1 / 0` |
143142
| `string` | The string is read "as is", whitespaces from both sides are ignored. An empty string becomes `0`. An error gives `NaN`. |
144143
145-
**`To Boolean`** -- Occurs in logical operations. Can be performed with `Boolean(value)`.
144+
**`Boolean Conversion`** -- Occurs in logical operations. Can be performed with `Boolean(value)`.
146145
147146
Follows the rules:
148147

0 commit comments

Comments
 (0)