Skip to content

Commit caaa05b

Browse files
authored
Merge pull request #3113 from leviding/patch-2
feat: improve type conversion for string with whitespace
2 parents 5d57a04 + 52a6df9 commit caaa05b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Numeric conversion rules:
7070
|`undefined`|`NaN`|
7171
|`null`|`0`|
7272
|<code>true&nbsp;and&nbsp;false</code> | `1` and `0` |
73-
| `string` | Whitespaces from the start and end are removed. If the remaining string is empty, the result is `0`. Otherwise, the number is "read" from the string. An error gives `NaN`. |
73+
| `string` | Whitespaces (includes spaces, tabs `\t`, newlines `\n` etc.) from the start and end are removed. If the remaining string is empty, the result is `0`. Otherwise, the number is "read" from the string. An error gives `NaN`. |
7474

7575
Examples:
7676

@@ -130,7 +130,7 @@ The conversion follows the rules:
130130
|`undefined`|`NaN`|
131131
|`null`|`0`|
132132
|<code>true&nbsp;/&nbsp;false</code> | `1 / 0` |
133-
| `string` | The string is read "as is", whitespaces from both sides are ignored. An empty string becomes `0`. An error gives `NaN`. |
133+
| `string` | The string is read "as is", whitespaces (includes spaces, tabs `\t`, newlines `\n` etc.) from both sides are ignored. An empty string becomes `0`. An error gives `NaN`. |
134134
135135
**`Boolean Conversion`** -- Occurs in logical operations. Can be performed with `Boolean(value)`.
136136

0 commit comments

Comments
 (0)