Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
325.234 to string?
is it toString()?
Simplest way, concatenate it with an empty string:
325.234 + '';
Which will implicitly call toString() on the number.
toString()
You could also use:
String(325.234);
And:
325.234.toString();
Add a comment
Sure, why not just:
325.234.toString()
or String(325.234)
String(325.234)
var number = 123.54 var string = number.toString();
The "toString()" method is called implicitly when you use a non-string as part of a string concatenation. Such as:
var newString = "Hello " + number;
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.