From 6505121c9e344efe2ac7dfb60599e5a1a07e2836 Mon Sep 17 00:00:00 2001 From: sawyerrken Date: Wed, 27 Mar 2019 09:18:51 +0100 Subject: [PATCH 1/2] modified sub headings for clarity and to avoid confusion --- 1-js/02-first-steps/06-type-conversions/article.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/1-js/02-first-steps/06-type-conversions/article.md b/1-js/02-first-steps/06-type-conversions/article.md index 95d0fa46..be625f9d 100644 --- a/1-js/02-first-steps/06-type-conversions/article.md +++ b/1-js/02-first-steps/06-type-conversions/article.md @@ -10,7 +10,7 @@ There are also cases when we need to explicitly convert a value to the expected 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 . ``` -## ToString +## String Conversion String conversion happens when we need the string form of a value. @@ -30,7 +30,7 @@ alert(typeof value); // string String conversion is mostly obvious. A `false` becomes `"false"`, `null` becomes `"null"`, etc. -## ToNumber +## Numberic Conversion Numeric conversion happens in mathematical functions and expressions automatically. @@ -94,7 +94,7 @@ alert( '1' + 2 ); // '12' (string to the left) This only happens when at least one of the arguments is a string. Otherwise, values are converted to numbers. ```` -## ToBoolean +## Boolean Conversion Boolean conversion is the simplest one. @@ -129,9 +129,9 @@ alert( Boolean(" ") ); // spaces, also true (any non-empty string is true) The three most widely used type conversions are to string, to number, and to boolean. -**`ToString`** -- Occurs when we output something. Can be performed with `String(value)`. The conversion to string is usually obvious for primitive values. +**`String Conversion`** -- Occurs when we output something. Can be performed with `String(value)`. The conversion to string is usually obvious for primitive values. -**`ToNumber`** -- Occurs in math operations. Can be performed with `Number(value)`. +**`Numeric Conversion`** -- Occurs in math operations. Can be performed with `Number(value)`. The conversion follows the rules: @@ -142,7 +142,7 @@ The conversion follows the rules: |true / false | `1 / 0` | | `string` | The string is read "as is", whitespaces from both sides are ignored. An empty string becomes `0`. An error gives `NaN`. | -**`ToBoolean`** -- Occurs in logical operations. Can be performed with `Boolean(value)`. +**`Boolean Conversion`** -- Occurs in logical operations. Can be performed with `Boolean(value)`. Follows the rules: From bb159fcac3aa0e6c3efc806d621aad73d11f8d8a Mon Sep 17 00:00:00 2001 From: sawyerrken Date: Tue, 2 Apr 2019 20:45:08 +0100 Subject: [PATCH 2/2] Update article.md --- 1-js/02-first-steps/06-type-conversions/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/06-type-conversions/article.md b/1-js/02-first-steps/06-type-conversions/article.md index be625f9d..f214a207 100644 --- a/1-js/02-first-steps/06-type-conversions/article.md +++ b/1-js/02-first-steps/06-type-conversions/article.md @@ -30,7 +30,7 @@ alert(typeof value); // string String conversion is mostly obvious. A `false` becomes `"false"`, `null` becomes `"null"`, etc. -## Numberic Conversion +## Numeric Conversion Numeric conversion happens in mathematical functions and expressions automatically.