-1
I’m caught in a programming logic problem, where you need to create a Javascript function that gets any decimal and convert to binary.
-1
I’m caught in a programming logic problem, where you need to create a Javascript function that gets any decimal and convert to binary.
1
DEC2BIN
converts a decimal number to a binary number
function dec2bin(dec){
return (dec >>> 0).toString(2);
}
console.log(dec2bin(256));
console.log(dec2bin(1024));
Resultado Formula
1010 = DEC2BIN(10)
01010 = DEC2BIN(10, 5)
1111100000 = DEC2BIN(-32)
too! Thank you
Browser other questions tagged javascript logic
You are not signed in. Login or sign up in order to post.
Put your code here so everyone can see and help.
– Fabiano Monteiro
Wouldn’t it be easy to use what’s ready? https://answall.com/a/134455/101
– Maniero
Welcome Pedro Castro, for success in his questions read this post https://answall.com/help/mcve
– user60252