Answers for "convert binary number to decimal javascript"

5

javascript convert string to 2 decimal

var twoPlacedFloat = parseFloat(yourString).toFixed(2)
Posted by: Guest on July-31-2020
4

convert binary to decimal javascript

var digit = parseInt(binary, 2);
Posted by: Guest on January-14-2020
1

convert binary to decimal javascript

const binaryArrayToNumber = arr => {
    let len = arr.length
    let pow = []
    let decimal = []
    for(let i = 0; i <= len - 1; i++){
        pow.unshift(i)
    }
    arr.forEach((x,index) => {
        decimal.push(x*2**pow[index])
    })
    let toDecimal = decimal.reduce((acc, curr) => acc + curr, 0)
    return toDecimal
};
console.log(binaryArrayToNumber([1, 0, 1, 1]))
Posted by: Guest on June-15-2020

Code answers related to "convert binary number to decimal javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language