Use Javascript Intl.NumberFormat - Javascript Language Basics

Javascript examples for Language Basics:Intl

Description

Use Javascript Intl.NumberFormat

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*  ww w .  java2 s . c  o  m*/
var amount = 5000.25;
var locale = 'de';
var options = {style: 'currency', currency: 'eur', minimumFractionDigits: 2, maximumFractionDigits: 2};
var formatter = new Intl.NumberFormat(locale, options);
console.log(formatter.format(amount));
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials