From 09da2a9cda5812fe7c0362a097e9fcd5ff4b825c Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 2 Dec 2019 23:25:56 +0300 Subject: [PATCH] content fixes, #1646 --- .../02-first-steps/06-type-conversions/article.md | 15 ++------------- .../solution.md | 0 .../3-primitive-conversions-questions}/task.md | 0 3 files changed, 2 insertions(+), 13 deletions(-) rename 1-js/02-first-steps/{06-type-conversions/1-primitive-conversions-questions => 07-operators/3-primitive-conversions-questions}/solution.md (100%) rename 1-js/02-first-steps/{06-type-conversions/1-primitive-conversions-questions => 07-operators/3-primitive-conversions-questions}/task.md (100%) 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 0d16d9be..e7c38125 100644 --- a/1-js/02-first-steps/06-type-conversions/article.md +++ b/1-js/02-first-steps/06-type-conversions/article.md @@ -1,6 +1,6 @@ # Type Conversions -Most of the time, operators and functions automatically convert the values given to them to the right type. +Most of the time, operators and functions automatically convert the values given to them to the right type. For example, `alert` automatically converts any value to a string to show it. Mathematical operations convert values to numbers. @@ -81,18 +81,7 @@ alert( Number(false) ); // 0 Please note that `null` and `undefined` behave differently here: `null` becomes zero while `undefined` becomes `NaN`. -````smart header="Addition '+' concatenates strings" -Almost all mathematical operations convert values to numbers. A notable exception is the addition `+` operator. If one of the added values is a string, the other one is also converted to a string. - -Then, it concatenates (joins) them: - -```js run -alert( 1 + '2' ); // '12' (string to the right) -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. -```` +Most mathematical operators also perform such conversion, we'll see that in the next chapter. ## Boolean Conversion diff --git a/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md similarity index 100% rename from 1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md rename to 1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md diff --git a/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/task.md b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/task.md similarity index 100% rename from 1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/task.md rename to 1-js/02-first-steps/07-operators/3-primitive-conversions-questions/task.md