JavaScript number-to-string conversion
JavaScript number-to-string conversion.
a = a+'' // This converts a to string b += '' // This converts b to string 5.41 + '' // Result: the string '5.41' Math.PI + '' // Result: the string '3.141592653589793'Another way:
a = a.toString() // This converts a to string b = b.toString() // This converts b to string (5.41).toString() // Result: the string '5.41' (Math.PI).toString() // Result: the string '3.141592653589793'