The last test kills me :D
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: Sept. 27, 2019, 12:11 p.m.
Updated: Sept. 27, 2019, 11:44 p.m.
0