Can you guys please help me in this matter :
I have two variable in jquery x and y , and I am doing a division between those two , and I let's say the result is 2.5 , but I only want to show 2 from 2.5 , how do I do that?
Can you guys please help me in this matter :
I have two variable in jquery x and y , and I am doing a division between those two , and I let's say the result is 2.5 , but I only want to show 2 from 2.5 , how do I do that?
If you're simply trying to truncate the decimal, use the following:
parseInt(2.5); // returns 2
If you're trying to round to the nearest integer, use the following:
Math.round(2.5); // returns 3
If you're trying to round down, use the following:
Math.floor(2.5); // returns 2
If you're trying to round up, use the following:
Math.ceil(2.5); // returns 3