JSFiddle - React, Tailwind, and code Playground

JavaScript

if (!Number.toFixed){
    Number.prototype.toFixed = function(n){
        return Math.round(this * Math.pow(10, n)) / Math.pow(10, n);
    }
}

var num = 123.4507;
$('body').append(num.toFixed(3));