[英]Actionscript to Javascript
AS3:
public static function testFunction(a:Number, b:String="", c:String=""):String {
var fmt:NumberFormatter = new NumberFormatter();
fmt.precision = -1;
fmt.useThousandsSeparator = false;
var s:String = fmt.format(a);
}
如何將其轉換為Javascript。 我很困惑,我認為我需要在JS中使用NumberFormatter。 有什么建議嗎?
您可以這樣設置精度
var num = 13.3714;
var n = num.toPrecision(2);
有關更多信息,請參見http://www.w3schools.com/jsref/jsref_toprecision.asp
還有http://openexchangerates.github.io/accounting.js/和
http://numeraljs.com/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.