To convert a number from base 2 to base 10 in javascript, we can use the parseInt()
function:
index.tsx184 chars5 lines
In this example, we pass the binary number 1101
and the base 2
as arguments to the parseInt()
function, which returns the decimal equivalent 13
.
gistlibby LogSnag