How to disregard remainder or decimal values:
Example: var x = 5/2;
Result: x = 2.5;
What i want is that whatever decimal value will be disregarded so the final output should be x = 2;
How to disregard remainder or decimal values: Example: var x = 5/2; Result: x
Share
You could use
Math.floor()(round down),Math.ceil()(round up) orMath.round()(round to nearest integer), dependening on how you wanted to remove the decimal.Example:
if
x = 2.5,Math.floor(x) = 2,Math.ceil(x) = 3,Math.round(x) = 3.For Reference:
Check the fiddle http://jsfiddle.net/BVYDR/