Javascript ToLocaleString() Function

The toLocaleString() function of number object return string with language specific representation of this number. Use it for example to get display language specific number.

Syntax

num.toLocaleString([locales [, options]])

Javascript ToLocaleString() Function Example1

<DOCTYPE html>
<html> 
<head> 
<script type="text/javascript">
var num= 123644;

//US specifc
document.write(num.toLocaleString() + "</br>"); 
//German specific 
document.write(num.toLocaleString('de-DE') + "</br>"); 
//India specifc
document.write(num.toLocaleString('en-IN') + "</br>"); 
</script>
</head>
<body>
</body>
</html>

Javascript ToLocaleString() Function Example2

<DOCTYPE html>
<html> 
<head> 
<script type="text/javascript">
var num= 123644.4342;

//US specifc
document.write(num.toLocaleString('en-US',{ style: 'currency', currency: 'USD' }) + "</br>"); 
//German specific 
document.write(num.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) + "</br>"); 
//India specifc
document.write(num.toLocaleString('hi-IN',{ style: 'currency', currency: 'INR' }) + "</br>"); 
</script>
</head>
<body>
</body>
</html>