Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript convert number to binary

function dec2bin(dec){
    return (dec >>> 0).toString(2);
}

dec2bin(1);    // 1
dec2bin(-1);   // 11111111111111111111111111111111
dec2bin(256);  // 100000000
dec2bin(-256); // 11111111111111111111111100000000
Comment

convert decimal to binary javascript

var n = 5;
n.toString(2); // "101"
Comment

javascript convert number to binary

Number(42).toString(2);

// "101010"
Comment

javascript integer to binary

function dec2bin(dec){
    return (dec >>> 0).toString(2);
}

dec2bin(1);    // 1
dec2bin(256);  // 100000000
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery select direct child 
Javascript :: convert timestamp to date js 
Javascript :: javascript yyyy-mm-dd to mm-dd-yyyy human readable format 
Javascript :: address 
Javascript :: how to append item to an array in foreach javascript 
Javascript :: tofixed javascript 
Javascript :: date javascript 
Javascript :: js how to find max value in an array 
Javascript :: check phone number validation in javascript 
Javascript :: looping through json array 
Javascript :: react input radio button 
Javascript :: javascript documentation 
Javascript :: get string length javascript 
Javascript :: jquery camera priview 
Javascript :: svelte wait 
Javascript :: how to update state in react 
Javascript :: smooth scroll react 
Javascript :: TypeError: path must be absolute or specify root to res.sendFile 
Javascript :: call a function 
Javascript :: create uuid to exist node neo4j 
Javascript :: round value down html 
Javascript :: node express dynamic route and error handler 
Javascript :: match characters in curly braces regex js 
Javascript :: jsx not working in react vscode 
Javascript :: change base js 
Javascript :: javascript foreach table 
Javascript :: reactjs .net pass value to react 
Javascript :: cypress element length 
Javascript :: node js error 
Javascript :: write data in props.histroy.push in react component 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =