JSFiddle - React, Tailwind, and code Playground
HTML
<div id='result'></div>
JavaScript
var val = 10;
function moneyRound(flt){
var splitStr = flt.toString().split('.'),
whole = (flt * 100) | 0;
if (splitStr.length > 1 && splitStr[1].length > 2){
return splitStr[1][2] > 4? (whole + 1) / 100: whole / 100;
} else {
return flt;
}
}
$('result').set('html', moneyRound(val));