Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript tousand seperator

function formatNumber(num) {
  return num.toString().replace(/(d)(?=(d{3})+(?!d))/g, '$1,')
}

console.info(formatNumber(2665)) // 2,665
console.info(formatNumber(102665)) // 102,665
console.info(formatNumber(111102665)) // 111,102,665
Source by blog.abelotech.com #
 
PREVIOUS NEXT
Tagged: #javascript #tousand #seperator
ADD COMMENT
Topic
Name
6+7 =