code lmao

This commit is contained in:
array-in-a-matrix 2022-02-08 22:59:39 -05:00
parent a591aeb358
commit 16ce3441da

View file

@ -0,0 +1,18 @@
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
readline.question(`Enter a number to convert: `, num => {
num = parseInt(num)
readline.question(`Enter a number new base: `, base => {
base = parseInt(base)
try {
new_num = num.toString(base)
console.log(`BASE 10:${num} ==> BASE ${base}: ${new_num}`);
} catch (RangeError) {
console.log(`Base is not in the range of 2 to 36.\nExiting...`);
}
readline.close()
})
})