Through applying a computer science algorithm in JavaScript, could you solve the following question?
The function accepts a numerator and denominator in the form of a positive or negative integer value.
You can not use '*', '/' or '%'.
function divide(num, denom) {
// ...
}
divide(6, 2)
divide(-10, 5)
divide(7, 2)
divide(-5, 10)
I am curious to know if there is a known computer science algorithm out there that can solve this.