let convertStrToNumber = function(str){
let num = 0;
let k=0;
for(let i=str.length-1;i>=0;i–){
if(parseInt(str[i]) ===1){
num=num | (1<<k);
}
k++;
}
return num;
}
can you please tell me what is wrong with this?
wrong o/p for:
s =“1111011110000011100000110001011011110010111001010111110001”