skip to Main Content

I’m not able to find the exact format to round numbers (no digits after the decimal) in Numbro with the old format (v1).
Found a Github issue that looks like it’s the same question, but haven’t been able to find any other resource.
Using the try me from Numbro, I would want 12345.67 to be formatted as 12346 (rounding to 0 digits after the decimal). 0.0, 0., 0[.] and similar variants don’t work

2

Answers


  1. use parseInt()
    it will parse all value to integer

    parseInt("11.38");
    
    output - 11
    

    reference https://www.w3schools.com/jsref/jsref_parseint.asp

    Login or Signup to reply.
  2. Use Math.round():

    console.log('Math.round(35.5) =>', Math.round(35.5));
    
     
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search