javascript number format indian currency
(1234567.8).toFixed(2).replace(/(\d)(?=(\d{2})+\d\.)/g, '$1,') // "12,34,567.80" var x=12345678;
x=x.toString();
var lastThree = x.substring(x.length-3);
var otherNumbers = x.substring(0,x.length-3);
if(otherNumbers != '')
lastThree = ',' + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
alert(res);
Also in JavaScript:
- javascript swap array elements
- how to create show more item in javascript
- javascript add div
- how to get the selected index of dropdown in jquery
- javascript for loop over dictionary
- javascript how to remove first element of array
- mongoose setup
- benchmark ram usage angular
- datatable on error.dt
- angular back button
- jstl spring taglib
- text editor
- loopback float type
- how to get state value from history react
- mapstatetoprops redux
- hoisting js
- === in js
- javascript subset of object array matching certain property
- remarkable react js
- how get checkbox if checked in jquery
- js index to index
- vscode display zsh characters
- update url parameters and create history entry
- mm dd yyyy how to get date in this format in javascript