data = parseInt(num);
bin =0;
pow=1;
var rem=0 ;
while(data != 0){
rem = data % 2;
data = data / 2;
bin = rem * pow + bin;
pow = pow *10;
}
document.write(bin);
I encountered an issue with my JavaScript code. Even though the example should output 110110 for 53, it seems to print infinity instead. Can anyone help me locate where I went wrong?