I know that I can round a number like this
var number = 1.3;
Math.round(number);
and the result I’m given is 1.
But how can I round a number to the next highest whole number? So round 1.3 to 2 instead of 1?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As an aside, in platforms with no
ceilmethod available, and assumingroundrounds to the nearest integer, a common trick used to round upwards is: