by @kodeazy

JavaScript How to round float value two 2 decimals?

Home » javascript » JavaScript How to round float value two 2 decimals?
  • To round a value to two decimal points in javascript we use toFixed function.
  • Below is the syntax.
  • number.toFixed(2).
  • Below is an example program.

    let number=123.23456
    console.log(number.toFixed(2));

    Output:

    123.23