Bit calculator

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
function calculate(num1, num2){
return num1.parseInt(2) + num2.parseInt(2);
}
String.prototype.parseInt = function (radix) {
var result = 0;
var pow = 1;
for (var i = this.length - 1; i >= 0; i--) {
result += +this[i] * pow;
pow *= radix;
}
return result;
};