I want to have the calculated number use commas. So instead of $1000, I want $1,000 etc. How do I go about doing this in my codepen? Thanks. https://codepen.io/creativecodepenuser/pen/JjbVQxY
@MyTrueName I added yearlyFunnyMoney.toLocaleString('en-US', { style: 'currency', currency: 'USD' })
as your article suggested but it doesn’t really do anything.
Because you must assign the value returned from the toLocaleString
method to a variable. yearlyFunnyMoney
does not change unless you assign a different value to it.
You could do that by:
yearlyFunnyMoney = yearlyFunnyMoney.toLocaleString('en-US', { style: 'currency', currency: 'USD' })
1 Like
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.