In JavaScript, how do I get:
- the whole number of times a given integer goes into another?
- the remainder?
Answer
For some number y and some divisor x compute the quotient (quotient) and remainder (remainder) as:
var quotient = Math.floor(y/x);
var remainder = y % x;
No comments:
Post a Comment