code coding computer data

This has Indian Rupee format using Javascript with Comma. This code you can copy paste to your project.

<script>
function indiancurrency(amt)
{
var x=amt;
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;
return res;
}
</script>
<script>
alert(indiancurrency(5000));
</script>

Video Demonstration:

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments