Created
April 18, 2018 19:12
-
-
Save montanaflynn/05fd9c01208be3870c2f484448ba02ed to your computer and use it in GitHub Desktop.
Division of integers while keeping the remainder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = 100 | |
var b = 3 | |
function divideWithRemainder(a, b){ | |
return { | |
quotient: ~~(a / b), | |
remainder: a % b | |
}; | |
} | |
console.log(divideWithRemainder(a, b)); | |
// { | |
// quotient: 33, | |
// remainder: 1 | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment