Getting the Integer Portion from a Division

Hello,

Basically I’m seeking the opposite of the mod (%) operator. For example, if I divide 14 by 5, I want 2, not the remainder 4.

How do I do this?

Thanks,

Sean

Use parseInt to grab the integer portion:


var x = 14;
var y = 3;
var resultWhole = parseInt(x/y); //should return 4

Math.floor(14/5) will work