Skip to content

The most correct way to get a simple string? #405

Answered by scurker
vresetnikov asked this question in Q&A
Discussion options

You must be logged in to vote

Depending on how you're using it, you may not have to do anything:

const value = currency(1234.56)
// The value below will automatically be coerced to the string value of "1234.56"
document.getElementById('amount').value = value

Otherwise, you can call .toString() directly, or .format() if you want to have a formatted string value with a currency symbol and group separators.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by scurker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants