How to perform an integer division and get the remainder in JavaScript

1 Answer

0 votes
const x = 23, y = 3;

const quotient = Math.floor(x / y);
const remainder = x % y;

console.log(quotient);
console.log(remainder);
  
  
  
  
  
/*
run:
  
7
2
  
*/

 



answered May 6, 2022 by avibootz
...