// Given two binary strings, return their sum (also a binary string).

// For example,
// a = "11"
// b = "1"
// Return "100".




//UNFINISHED

var addBinary = function(a, b) {
    var aVal = 0;
    var bVal = 0;
    var counter = 0;
    for(var i = 0; i < a.length; i++){
        if(a[i] === "1"){
            aVal += Math.pow(2, a.length-1 - i);
        }
    }
    for(var j = 0; j < b.length; j++){
        if(b[j] === "1"){
            bVal += Math.pow(2, b.length-1 - j);
        }
    }
    var sum = aVal + bVal;
    var str = Array(Math.floor(sum/Math.floor(Math.log2(sum)))+ 3).join('x');

    while(sum>1){
        str[counter] = sum%2;
        console.log(str);
        // console.log(counter)
        // console.log(sum%2)
        counter++;
        sum = Math.floor(sum/2);
        // console.log(str);
    }
    return str;
};

@@ -122,16 +122,233 @@
 100%22.%0A%0A%0A
+%0A//UNFINISHED%0A%0Avar addBinary = function(a, b) %7B%0A    var digitOne = parseInt(a, 2),%0A        digitTwo = parseInt(b, 2);%0A    var integer = JSON.stringify(digitOne + digitTwo);%0A%0A    return Number(integer).toString(2);%0A%0A%7D;
 %0A%0A//UNFI

add unfinished solution