The calculation is equal to the sum of the total binary digits times their power of 2:
For example, 001101002 = 0*27 + 0*26 + 1*25 + 1*24 + 0*23 + 1*22 + 0*21 + 0*20
=> 0 + 0 + 32 + 16 + 0 + 4 + 0 + 0
=> 52
Decimal numbers are the most common type of numbering system. Decimal numbers are used in our daily life for trading and calculation. Decimal numbers are the easiest for humans to understand. For that reason, it is popular.
function binarytodecimal() {
var input = document.getElementById("input_value").value;
var answer = new BigNumber(input, 2);
document.getElementById("answer").innerHTML = answer;
}