Interval Math calculator on Javascript