Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Print a number with commas as thousands separators in JavaScript

// A more complex example: 
number.toLocaleString(); // "1,234,567,890"

// A more complex example: 
var number2 = 1234.56789; // floating point example
number2.toLocaleString(undefined, {maximumFractionDigits:2}) // "1,234.57"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Print #number #commas #thousands #separators #JavaScript
ADD COMMENT
Topic
Name
5+1 =