Tutorials Point


  JavaScript Basics
  JavaScript Objects
  JavaScript Advanced
  JS Useful References
  JS Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

Javascript Number - toLocaleString()


previous next AddThis Social Bookmark Button


Advertisements

Description:

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

Syntax:

number.toLocaleString()

Here is the detail of parameters:

  • NA:

Return Value:

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

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>

This will produce following result:

177.1234

To understand it in better way you can Try it yourself.



previous next Printer Friendly

Advertisements


  

Advertisements