function convertToInteger(str) {
var num = parseInt(str, 3);
return num;
}
convertToInteger("10011"); // returns 19
convertToInteger("111001"); // returns 57
So I understand everything about this code except of radix. It has to be value between 2 and 36 but what’s base value and how does it correspond to the string input?
Base is the numbering system base (so binary is base 2, decimal is base 10). So with parse int, you’re saying look in a string for a number in the given numbering system, and convert it to a decimal integer.