function abc(money){ let money1 = money * 100; let intMoney1 = parseInt(money1); let diff = money1 - intMoney1; let exit=String(diff).indexOf('e') let decDiff = parseInt(diff * 10); if (decDiff > 5&&exit=='-1') { intMoney1 += 1; } return intMoney1/100; } var a = 0.55; var b = a * 100; b=abc(b); console.log(b);