千分位

Run Settings
LanguageJavaScript
Language Version
Run Command
function a(b){ console.log(b); } // fundation function c(str){ let split = str.split("."); let int = split[0], len = int.length, ret = ""; //core code while((len -= 3) > 0){ ret = ","+int.substring(len,len+3)+ret; } ret = int.substring(0,len+3)+ret; if(split.length>1){ ret += "."+split[1]; } return ret; } function d(str){ let start = new Date().getTime(); let ret = c(str); a("ET: "+ (new Date().getTime()-start)+" ms"); return ret; } //for test a(d("")); a(d("1234")); a(d("1234567890.123456")); let startt = new Date().getTime(); let str = "1234567890.123456"; let k = 0; while(k++<2000000){ c(str) } a("ET: "+ (new Date().getTime()-startt)+" ms/2000000");
Editor Settings
Theme
Key bindings
Full width
Lines