javascript - Using .toLocaleString() in Node.js -


So I was writing a small subsidiary method to convert numbers into a valid currency format ( $ xx , Xxx.xx ) using .toLocaleString () . All the required work is done while using it inside the chrome, although it is completely broken when used inside node.js.

Example:

  var n = 6000 console.log (n .toLocaleString ('USD', {style: 'currency', currency: "USD", minimum Fractures: 2, maximum fretting: 2}));   

If you run it in the browser, it prints $ 6,000.00 . If you run this snippet inside the Node.js REPL or application, then it returns 6000 as a string.

Is it supposed to be a bug with Node.js? Is there a work around you that you can do here? Based on this, it was decided that with the shipping node internationalization, J. S. It will make it big You can do npm installed intl and need it, and it will replace toLocaleString with the version that works.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -