Answers for "how to declare binary in js"

0

how to convert to binary in javascript

function bin(num) {
    var binn = [];
    var c;
    while (num != 1) {
        c = Math.floor(num / 2);
        binn.unshift(num % 2);
        num = c;

    }
    binn.unshift(1)
    return binn
}
//returns list of binary nos. in order
Posted by: Guest on September-08-2020
0

js binary

const binary = n.toString(2);
Posted by: Guest on June-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language