JavaScript culture sensitive currency formatting

不羁岁月 提交于 2019-12-01 05:47:07

there is a Number.localeFormat function but I'm not sure it's what your after

http://msdn.microsoft.com/en-gb/library/bb310813.aspx

Dojo has a currency formatter that's locale aware.

If you don't want to include Dojo in your project just for this function, then perhaps you can localize the currency in your back-end?

Number.toLocaleString (implemented in JavaScript 1.5, ECMAScript 3rd Edition)

var number = 3500;
console.log(number.toLocaleString()); /* Displays "3,500" in English locale */

Docs on MDN.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!