How could I round a number down to the ones place in JavaScript? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

How could I round a number down to the ones place in JavaScript?

Is there a keyword or something?

20th Feb 2019, 11:53 PM
team fortress 2
team fortress 2 - avatar
2 Respuestas
+ 10
Or if you want something like 3.14159 => 3.1 Have a look ~ https://www.sololearn.com/Discuss/264815/?ref=app
21st Feb 2019, 5:55 AM
Nikhil
Nikhil - avatar
+ 5
To round down, use Math.floor or ~~ (e.g. ~~(3.141592653) = 3). To round up, use Math.ceil.
21st Feb 2019, 5:43 AM
Rowsej
Rowsej - avatar