Use NumberFormat to get the number format currency in JavaScript. This is part of the Internationalization API. This constructor creates Intl.NumberFormat
objects that enable language-sensitive number formatting.
Example get number format currency in JavaScript
simple example code.
<!DOCTYPE html>
<html>
<body>
<script>
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',});
console.log(formatter.format(2500));
console.log(formatter.format(1000000));
</script>
</body>
</html>
Output:
![JavaScript number format currency](https://i0.wp.com/tutorial.eyehunts.com/wp-content/uploads/2022/02/JavaScript-number-format-currency.jpg?resize=228%2C102&ssl=1)
Do comment if you have any doubts or suggestions on this JS format currency topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version