DEV Community

Discussion on: Javascript Arithmetic Cheat Sheet

Collapse
 
oscherler profile image
Olivier “Ölbaum” Scherler

Nice write up. You could add an example with a negative number for Math.round().

About the use of Infinity, I think it’s useful when you are comparing results. If you do something like if(1/x > 1/y) and one of x or y turns out to be 0, then the comparison still works.

Collapse
 
wangonya profile image
Kelvin Wangonya

Thanks! I've added the example and your note on the use of infinity.