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)) {
console.log(-1);
return -1; } else {
console.log(sol);
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?
love
Fabian
Created at: 2019/09/27 12:11; Updated at: 2019/09/27 23:44