Dividing and rounding up

wegs

How can i dividing and rounding up in javascript? For example:

var one = 10/4; 

This return 2.5, but i would like receive 3

var two = 120/7;

This return 17.14, but i would like receive 18

etc

How is the best way for this?

dave

You can use Math.ceil:

Math.ceil(10/4); //3

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related