JavaScript Intl NumberFormat() is the format of the number based on locale. This constructor creates Intl.NumberFormat objects that enable language-sensitive number formatting.
Example JavaScript Intl NumberFormat() object
Simple HTML example code formats a number according to the locale.
Basic usage
<!DOCTYPE html>
<html>
<head>
<script>
var number = 3500;
var res =new Intl.NumberFormat().format(number);
console.log(res);
</script>
</head>
</html>
Output:
Using locales
var number = 123456.789;
// German uses comma as decimal separator and period for thousands
console.log(new Intl.NumberFormat('de-DE').format(number));
// → 123.456,789
// Arabic in most Arabic speaking countries uses real Arabic digits
console.log(new Intl.NumberFormat('ar-EG').format(number));
// → ١٢٣٤٥٦٫٧٨٩
// India uses thousands/lakh/crore separators
console.log(new Intl.NumberFormat('en-IN').format(number));
// → 1,23,456.789
// the nu extension key requests a numbering system, e.g. Chinese decimal
console.log(new Intl.NumberFormat('zh-Hans-CN-u-nu-hanidec').format(number));
// → 一二三,四五六.七八九
// when requesting a language that may not be supported, such as
// Balinese, include a fallback language, in this case Indonesian
console.log(new Intl.NumberFormat(['ban', 'id']).format(number));
// → 123.456,789
Source: https://developer.mozilla.org/
Do comment if you have any doubts or suggestions on this JS NumberFormat() topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version