How to round a number up in JavaScript

2 Answers

0 votes
let n = 3.3;
console.log(Math.ceil(n));

n = 3.9;
console.log(Math.ceil(n));

n = 101.17;
console.log(Math.ceil(n));
  
  
  
/*
run:
 
4
4
102
  
*/

 



answered Jun 13, 2015 by avibootz
edited Apr 27, 2024 by avibootz
0 votes
console.log(Math.ceil(5.3));
console.log(Math.ceil(5.4));
console.log(Math.ceil(5.5));
console.log(Math.ceil(5.6));

  
  
/*
run:
 
6
6
6
6
  
*/

 



answered Apr 27, 2024 by avibootz

Related questions

1 answer 256 views
1 answer 232 views
1 answer 259 views
1 answer 231 views
1 answer 200 views
...