Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 52a6df9

Browse files
feat: type conversion for string with whitespace
1 parent 7000ede commit 52a6df9

File tree

1 file changed

+2
-2
lines changed
  • 1-js/02-first-steps/07-type-conversions

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /