JSFiddle - React, Tailwind, and code Playground

by mblase75

JavaScript

var one = 1.0000
    var two = 1.1000
    var three = 1.1200
    var four = 1.1230
    
function tofixed(val)
{
   return parseFloat(val.toFixed(2));
}

console.log(tofixed(one));
console.log(tofixed(two));
console.log(tofixed(three));
console.log(tofixed(four));