You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
function bin_to_dec(bstr) {
|
|
return parseInt((bstr + '')
|
|
.replace(/[^01]/gi, ''), 2);
|
|
}
|
|
console.log(bin_to_dec('110011'));
|
|
console.log(bin_to_dec('100'));
|