Gayathri Kumaran posted: " I would like to convert 1.2 to 1.5 and 1.7 to 2. This is basically rounding a decimal number to nearest decimal that is divisible by 5. const roundToNearest5 = x => Math.ceil(x)-x > 0.5 ? Math.ceil(x)-0.5: Math.ceil(x); console.log(roundToNeares"
|

No comments:
Post a Comment
Note: Only a member of this blog may post a comment.