Js interception of a few decimal places behind the notation

  • 2020-03-29 23:47:03
  • OfStack

If the value of ${showinfo.tt} is 20 and you want it to be divided by 10 to 2 decimal places, you can write it in js code as follows:
var a = ${showInfo.tt}/10; 
//alert(a.toFixed(3)); // It's going to be behind the decimal point 3 The bits give a value of 2.000 
document.write(a.toFixed(2)); //The resulting value is 2.00

Related articles: