Division without using division, multiplication, or modulus operators
Is bitwise operation mandatory? There's a much simpler way

const divide = (dividend, divisor) =&gt; {
     let quotient = 0, neg = false;

     if( (dividend &lt; 0 &amp;&amp; divisor &gt; 0) || (dividend &gt; 0 &amp;&amp; divisor &lt; 0) ){ neg = true; }

     dividend = Math.abs(dividend);
     divisor = Math.abs(divisor);

     if(dividend &lt; divisor) {return 0;}
     else if(dividend &gt; 0 &amp;&amp; divisor != 0){
          while(dividend &gt;= divisor){
               dividend -= divisor;
               ++quotient;
          }
     } else { // handle what you want to do for those cases..}

     return neg ? -quotient : quotient;
}


You get your quotient and remainder is ignored. Just do a check if dividend is negative or divisor is 0.