javascript - Using .toLocaleString() in Node.js -
So I was writing a small subsidiary method to convert numbers into a valid currency format ( Example: If you run it in the browser, it prints 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 $ 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.
var n = 6000 console.log (n .toLocaleString ('USD', {style: 'currency', currency: "USD", minimum Fractures: 2, maximum fretting: 2}));
$ 6,000.00 . If you run this snippet inside the Node.js REPL or application, then it returns
6000 as a string.
npm installed intl and need it, and it will replace
toLocaleString with the version that works.
Comments
Post a Comment