suppose x=10/3. It displays 3.3333. I want to display 3. How's that possible? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
+ 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