-2

What function or method converts number (2354) to binary code (001011001010)? Thanks

Yar Ozerov
  • 11
  • 3
  • Unclear how you get the zeroes at the start of your binary version. Also, http://idownvotedbecau.se/noresearch/ – ASDFGerte Nov 26 '19 at 16:22

1 Answers1

1

try this :

number= 2345
binary = number.toString(2)
console.log(binary)

the result of this code is : 100100101001

btw : 001011001010 in binary is equal to 714 in decimal ;) https://www.rapidtables.com/convert/number/binary-to-decimal.html

elouassif
  • 308
  • 1
  • 10
  • Please don't answer questions that have been asked many times before. [We mark them as duplicate](https://stackoverflow.com/help/duplicates) so all the good and up-to-date content stays in one place. – Ivar Nov 26 '19 at 16:40
  • Thanks. Yeah, I've found the answer. Not good start for me in asking. Now trying to ask "is any analog of jquery.bacstretch in react" but I can't because of questions limit( – Yar Ozerov Nov 28 '19 at 09:52