My code goes like this:
binaryNextNumber(s) {
var currDec=parseInt(s,2)
currDec+=1
currDec=Number(currDec.toString(2))
return currDec
}
this code is expected to take a binary input and convert it to decimal then add 1 and return it as a binary.
When the input is”01100111011110101001111010100111011010101101000110001000001010010″ it takes the input as “8.829359853171427e+56” and completely messes up the code thereafter…
New contributor
vengefulSpartan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.