toFixed vs round

Benchmark created on


Setup

var a = 2345.5665,
        period = 2,
        c,
        b;

Test runner

Ready to run.

Testing in
TestOps/sec
round
c = Math.pow(10, period)
b = Math.round(parseInt(a * c)) / c;
ready
toFixed
b = +a.toFixed(period)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.