1. strings and numbers are added, converted into a digital string.
var one="This is a test"; var two=123; var three=one+two; // result: three: This is a test123
2. The digital values are added and Boolean, Boolean false turn into 0, true turn into a
var one=13; var two=true; var three=one+two; // 结果 three:14
3. String Boolean value is added, the Boolean value into a string.
var one=‘hello ’; var two=true; var three=one+two; // 结果 hello true
4. Digital and the null (empty value) are added, null into a digital 0:
var CAR = null + +. 4. 3; // result 7
The string and the null (empty value) are added, null string is converted to:
var CAR = null + "A"; // results nulla
6. The result of the modulo operation with only the left sign symbol values for:
var X =. 7%. 3; // results. 1 var Y =. 7% (-3); // results. 1 var Z = (-7)%. 3; // results -1
- % If left operand is positive, then the result of addition to the mold for positive or zero;
- % If left operand is negative, the result of the modulo negative or zero.
Summarized as follows:
1, can be a very powerful string data type; performed plus +, the object will be added to a string unitary.
2, bool type when added to the digital type, regarded as 0 or 1 process.
3, when the null type and digital type accumulates 0 considered treatment.
4, the null type bool type accumulates deemed to sum and processing integer type.
5, undefined except effective (undefined as a character string "undefined" process), otherwise returns are accumulated during string NaN.
6, modulo % computations, the computation result depends only on the sign of the first number.