content fixes, #1646
This commit is contained in:
parent
6cc9b624f9
commit
09da2a9cda
3 changed files with 2 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue