• The last test kills me :D

Question related to mission Number Base


Dear brothers and sisters!

I came up with a solution like this, which works mostly fine!

function numberRadix(str, num) {

    // str.toString(16);

    sol = parseInt(str, num);

    if (isNaN(sol)) {

    return -1; } else {

        return sol;


But at the last extra-test it won't work:

numberRadix("ASD", 15); // -1

I know it is because "ASD" can't be converted in the 15-number system, but I won't know how to work with the S-letter. Do you maybe know how to fix this?