How do you add a certain amount of zero at the end?



  • Can you tell me how to add a certain amount of zero at the end?

    // пример
    var sec = 0.015;
    var pre = 6;
    var res = "0.015000"; // как получить такое значение имея выше данные?
    


  • You can try that.

    // пример
    const sec = 0.015;
    const pre = 5;
    const res = sec.toPrecision(pre)
    

    console.log(res)


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2