I looked at this and read the description in another topic on this website. So the parseInt function with Radix is to see convert for example time into 60 seconds or 12 into hours. When I look at the problem I do not get it. I see that it has five possible digits in each slot: 10011. What am I doing wrong? Is my reasoning wrong for this problem?
Your code so far
function convertToInteger(str) {
var a = parseInt("10010",5)
}
convertToInteger("10011");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.
A radix (also called the base) is the number of digits ised in a numbering system: decimal is 10, binary is 2, octal is 8 and so on. parseInt takes a string, and the base of the numbering system, and converts it to a decimal integer. The strong you’ve given it is binary, a numbering system with two digits (0 and 1)
The fifth number in the binary numbering system is 101. So if you covert 101 (a binary number) to a decimal integer, which is what parseInt(“101”, 2) does, it’s 5. The binary system only has two numbers, 101 isn’t one hundred and one because one hundred and one isn’t a thing in binary. 101 is the number 101
No. Firstly 101.00 is not a thing in binary, you can’t have decimal points. 10011 is not the same number as 101, it’s clearly different. It’s not asking you to work it out and write the answer, you just put the number into the parseInt function and tell it that it’s binary and it works it out for you
101 in decimal form is 101. You are completely misunderstanding how number systems work. parseInt lets you convert from different number systems to decimal, you just give it a number, tell it what the base of the system is, and it gives you it back as a decimal (base 10) integer
It has nothing to do with the number of digits in a particular number. Binary is a number system that uses only two unique digits. Decimal is a number system that uses only 10 unique digits.
1 can still be a decimal number even though it doesn’t have 10 digits. So can 2, 3, 4, 5, 6, 7, 8, 9 10 and so on.
1 can still be a binary number even though it doesn’t have two digits. So can 101, 1101101, and 101111011101
So in any number system, each column of numbers represents that base raised to a power. So in a decimal system, the first column represents 10^0, or ones. The second column is 10^1 or tens. The third, 10^2, or hundreds. In a binary system, the same: the rightmost column is 2^0, or ones, then 2^1 or twos, then 2^2, or fours. So 101 in decimal is 1 in the fours column, zero in the twos column and 1 in the ones column: 4+0+1 = 5.
In fairness, number systems are a complex conversation. And while you COULD use parseInt with a radix of base 60 to convert to minutes, that’s just… hinky.