about | help | code help+videos | done | prefs |
roundToPlace
Math.round(value) only rounds to the nearest integer. In order to round to another decimal place, you have to shift the decimal point by multiplying or dividing first. roundToPlace(value, place) will use place to determine which decimal place to round to. 0: standard round to ones place. 1: round to tenths. -1: round to tens. etc. Hint: Use the place as an exponent for a power of 10. You can use Math.pow(base,expt) roundToPlace(1.2345, 0) → 1.0 roundToPlace(1.5, 0) → 2.0 roundToPlace(1.2345, 1) → 1.2 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy