About 85,000 results
Open links in new tab
  1. How to round float numbers in javascript? - Stack Overflow

    possible duplicate of round number in JavaScript to N decimal places -- please use the search before you ask a new question.

  2. How do I round a number in JavaScript? - Stack Overflow

    The actual one-liner is 'Math.round (number)'. The whole type casting business is unnecessary. In JavaScript strings are automatically coerced to numbers when needed.

  3. JavaScript math, round to two decimal places - Stack Overflow

    I have the following JavaScript syntax: var discount = Math.round(100 - (price / listprice) * 100); This rounds up to the whole number. How can I return the result with two decimal places?

  4. javascript - How to round to at most 2 decimal places, if necessary ...

    I'd like to round at most two decimal places, but only if necessary. Input: 10 1.7777777 9.1 Output: 10 1.78 9.1 How can I do this in JavaScript?

  5. How do you round to one decimal place in JavaScript?

    Can you round a number in JavaScript to one character after the decimal point (properly rounded)? I tried the *10, round, /10, but it leaves two decimals at the end of the int.

  6. How can I round to whole numbers in JavaScript? - Stack Overflow

    Aug 6, 2011 · How can I round to whole numbers in JavaScript? Asked 14 years, 4 months ago Modified 9 years, 4 months ago Viewed 124k times

  7. How to round up a number to a precision of tenths in JavaScript?

    This works great, but the OP asked how to round up a number, so Math.ceil should be used here instead of Math.round.

  8. Format number to always show 2 decimal places - Stack Overflow

    May 26, 2011 · Round the number with 2 decimal points, then make sure to parse it with parseFloat() to return Number, not String unless you don't care if it is String or Number.

  9. How can I round down a number in Javascript? - Stack Overflow

    288 How can I round down a number in JavaScript? math.round() doesn't work because it rounds it to the nearest decimal. I'm not sure if there is a better way of doing it other than breaking it …

  10. How to round an integer up or down to the nearest 10 using …

    May 14, 2014 · Using Javascript, I would like to round a number passed by a user to the nearest 10. For example, if 7 is passed I should return 10, if 33 is passed I should return 30.