Hello. Let's do a bit of JavaScript. "Number Formatting" I mean in the title is as such: 100 is formatted to 100 1000 is formatted to 1,000 10000 is formatted to 10,000 123456 is formatted to 123,456 9876543210 is formatted to 9,876,543,210 1123.58 is formatted to 1,123.58 By adding a comma separator every three digits. We can achieve that through: A loop. Using for — backwards loop. BUT! Before that, we need to separate — the negative sign — if exists, the digits part — this part is the subject of the formatting, and the decimals part. Then lump everything together as the final result. Power of regular expression. 💪👺 💪 Let us begin. Loop Method As I've mentioned above, this has separation stages, then the loop. You can read the comments in the code to understand the flow. function formatNumberWithLo...
Reflections on ECMAScript (JavaScript), CSS, HTML, Blogger, technical fixes, literature, music, cinema, entertainment in general, the English language, mathematics, history, trousers-related, and curiosities of the realm.