The universe is regulated by Math formulas” my grumpy teacher used to say. And the galaxy of coding isn’t escaping from that rule any time soon — as I was hoping. Luckily for us, a language like JavaScript gives us tools like the Math object to deal with numbers and their operations.

When it comes to rounding numbers, Math helps you with three main functions: Math.ceilMath.floorand Math.round.

Math.ceil

This method rounds up the only passed in value to the nearest greater integer. I find the word ceil meaningful in this case, as it reminds to a ceiling, to bringing something up. Or in our case, to raise a number to the next one.

Using Math.ceil

#technology #software-engineering #math #javascript #web-development

Math.ceil, Math.round and Math.floor in Your JavaScript
1.95 GEEK