In JavaScript, how do I get:

  1. The whole number of times a given integer goes into another?
  2. The remainder?

1
18

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;

Leave a Reply

Your email address will not be published. Required fields are marked *