Compatibility of Number.prototype.toLocaleString

Number.prototype.toLocaleString is used in amount formatting, but compatibility problems occur in some older browsers

var a = 10000000;
a.toLocaleString(); 
// chrome 68 "10,000,000" 
//  7.5.5 "10,000,000.000"

Sogou 7.5.5 is over .000
the original formatting function (formats the thousandth and retains two decimal places)

formatAmount: function (amount) { // 
  if (typeof amount === "undefined" || amount === "") return "";
  if (amount - 0 === 0) return "0.00";
  let num = amount - 0;
  let str = (num-0).toFixed(2); // 
  let num_int = str.split(".")[0];
  let num_point = str.split(".")[1];
  return `${(num_int-0).toLocaleString()}.${num_point}`;
}

after compatibility

formatAmount: function (amount) { // 
      if (typeof amount === "undefined" || amount === "") return "";
      if (amount - 0 === 0) return "0.00";
      let num = amount - 0;
      let str = (num-0).toFixed(2); // 
      let num_int = (str.split(".")[0] - 0).toLocaleString();
      let num_point = str.split(".")[1];
      return `${num_int.indexOf(".")>-1?num_int.split(".")[0]:num_int}.${num_point}`;
    }
The kernel version of

Sogou 7.5.5 is Chromium 49.0.2623
according to MDN shows that this method is supported. So how to judge this compatibility? Methods can be used, but the results returned are different.


.toLocaleString(undefined,{minimumFractionDigits:0,maximumFractionDigits:0})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32af6-2be3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32af6-2be3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?