A bit confusing approach:
var i=4.568, iToString = i + ''; i = parseFloat(iToString.match(/\d+\.\d{2}/)); console.log(i);
This effectively takes the variable i and converts it to a string, and then uses the regular expression to match the numbers before the decimal point and the next two decimal points, using parseFloat() to then convert it to a number.
Literature:
David thomas
source share