• JavaScript Video Tutorials

JavaScript Number - toLocaleString()



Description

This method converts a number object into a human readable string representing the number using the locale of the environment.

Syntax

Its syntax is as follows −

number.toLocaleString()

Return Value

Returns a human readable string representing the number using the locale of the environment.

Example

Try the following example.

<html>
   <head>
      <title>JavaScript toLocaleString() Method </title>
   </head>
   
   <body>      
      <script type = "text/javascript">
         var num = new Number(177.1234);
         document.write( num.toLocaleString()); 
      </script>   
   </body>
</html>

Output

177.1234
javascript_number_object.htm
Advertisements