All the common arithmetic operators will attempt to convert strings to numbers when applicable. | |
If a string cannot be converted to a number, NaN (Not A Number) will be returned. | |
Addition (+) | |
If the values on either side are numerical values, the values are added together. | |
IF the values are strings, they are concatenated together. | |
The following line of code | |
| |
would set the variable resultOfAdd equal to 46 | |
| |
would set the variable resultOfAdd equal to the string "ab". |