.toLocaleString and friends are some of the most underrated features of JavaScript. I came over them through a few different wanderings through MDN...
For further actions, you may consider blocking this person and/or reporting abuse
Not only in JS, there are bugs in some games due to forgetting about this when dealing with dates in C# in Unity and so on 😆
Haha, dates are a pain
Blain is a Pain
No Pain no Blain 💪🏼😂
I have used it for dates before, but really didn’t realize that I can do all of this ☺️
Great Article! 👏🏻👏🏻
Didn't even realise you can do all this, thank you for the sharing
My mind is blown, I've used it a ton of times for date formatting but didn't even know it had some more properties for dates! And that it can also be used for numbers 🤯.
I'm definitely trying this out.
Thanks for this piece.
awesome, why the .. for some items and not others?
In JavaScript, you can't directly access properties on numbers. You can either use 2 dots or braces instead
good one ..
I'm using this feature a lot when displaying dates !
Thanks, that helped a lot!!
Goodbye libraries for number formatting! =D
Good post and useful feature 👌
Thanks!
Nice 👍
I didn't know about that - WOW! this is awesome :) thank u very much for this article!
MIND BLOWN! I’ll use it for sure!! Thanks!!
I used it for dates only but very basic only. Didn't know all this was possible.
Thanks Siddharth!!
clear explanation ! :)
Thanks for sharing 👍
Thank you.
Exactly what I need at the moment. Thank you so much.
Was that pun intended 🤣
What are the differences between
Number#toString()andIntl.NumberFormat?.toStringdoesn't provide the features ofIntl. It only supports stringifying to a base.Sorry, I meant
.toLocaleString()The features are the same, except
Intlis faster when you need to run the stringification multiple timesAh, thanks!