Remove quotes around addition operator

This commit is contained in:
Brent Guffens 2018-01-17 11:29:07 +01:00 committed by GitHub
parent 59f6d8d0a2
commit 2fb940557d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,7 +54,7 @@ alert( 2 + '1' ); // "21"
See, it doesn't matter whether the first operand is a string or the second one. The rule is simple: if either operand is a string, then convert the other one into a string as well. See, it doesn't matter whether the first operand is a string or the second one. The rule is simple: if either operand is a string, then convert the other one into a string as well.
String concatenation and conversion is a special feature of the binary plus `"+"`. Other arithmetic operators work only with numbers. They always convert their operands to numbers. String concatenation and conversion is a special feature of the binary plus `+`. Other arithmetic operators work only with numbers. They always convert their operands to numbers.
For instance, subtraction and division: For instance, subtraction and division: