Printing leftmost zeros . Since ( 2 ^ n ) % 2 can have digits less then 2. In that case we need to prlet zeros
for ( let i = 0 ; i < ( 2 - numberOfDigits ( temp ) ) ; i ++ ) document . write ( 0 + " " ) ;