# Basic JavaScript - Use the parseInt Function with a Radix

Tell us what’s happening:
Just not understanding why this is converted to an integer with a value of 3. I understand that “11” has a radix of 2, because there are 2 digits in the string; but when converted, why does this turn to 3?
Any help is appreciated; thanks!

``````function convertToInteger(str) {
return parseInt(str, 2);
}

convertToInteger("10011");
``````

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15`

Challenge: Basic JavaScript - Use the parseInt Function with a Radix

The 11 is actually binary notation (so is the 1011 value).

Binary notation is a way of counting.
Most of us use something called decimal notation to count (0,1,2,3,4,5,6,7,8,9)
But computers use binary notation (0,1)

You can learn how this works by looking up ‘binary notation’ in any search engine.

1 Like

This makes a lot more sense. Im familiar with Binary , but I thought it was just a regular integer. Thank you!!

1 Like