1. Floating point conversion to integer type, this is more error-prone, many people like to use parseint (), in fact, parseint () is used to convert strings to numbers, rather than floating-point number and integer conversion between, we should use Math.floor () or Math.Round (). In addition, unlike the problem in the second section of the object lookup, math is an internal object, so Math.floor () actually does not have much of a query method and the time to call, the fastest speed.
2. Converting numbers to strings, applying "+ 1", although it looks uglier, is actually the highest efficiency, and performance says: ("+) > string () >. ToString () > New String (), try to use the inner Operations are faster than the user actions that are used at run time. A string () is an intrinsic function, so it is very fast, and. ToString () to query the function in the prototype, so the speed is somewhat inferior, and the new string () is used to return an exact copy.
3. For custom objects, if the ToString () method is defined for type conversion, an explicit call to ToString () is recommended, because the internal operation attempts to convert the object's ToString () method after attempting all possibilities.