Computer >> Computer tutorials >  >> Programming >> HTML

Number.toLocaleString() function in JavaScript


The toLocaleString() function of the Number object accepts a number and returns the representation of it in the specified (local) language.

Syntax

Its Syntax is as follows

num.toLocaleString(num);

Example

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var num = 3325;
      result = num.toLocaleString('ar-EG');
      document.write("Result: " + result);
   </script>
</body>
</html>

Output

Result: ٣٬٣٢٥