suppose x=10/3. It displays 3.3333. I want to display 3. How's that possible? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

suppose x=10/3. It displays 3.3333. I want to display 3. How's that possible?

Function used is document.write

28th Feb 2018, 5:34 AM
Gaurav Roy
Gaurav Roy - avatar
1 Réponse
+ 14
Math.floor() rounds a number down, and Math.round() rounds it up if the decimal is .5 and over, and down if less than .5.
28th Feb 2018, 5:37 AM
Tamra
Tamra - avatar