I need to write a function that will ALWAYS round up, but will either round up to 0, 1 or 2 decimal places, depending on if the function is passed a 0, 1 or 2.
Examples...
Round to 0 decimal places: 13.4178 = 14
Round to 1 decimal place: 13.4178 = 13.5
Round to 2 decimal places: 13.4178 = 13.42
I've found Math.ceil
but this only rounds up to a whole integer and to fixed()
will round up or down, not just up. Is there a way to round up in the way I've described above?