Nahrání kódu od kolegy do větve test_web

This commit is contained in:
archos
2024-06-30 18:29:44 +02:00
parent e0dc12c52d
commit 110e85b9c7
63 changed files with 6671 additions and 23 deletions

View File

@ -0,0 +1,19 @@
numberSystemConverter();
function numberSystemConverter() {
let num = document.getElementById("number").value;
let base = document.getElementById("base").value;
let new_base = document.getElementById("new-base").value;
base = parseInt(base);
new_base = parseInt(new_base);
try {
let dec_num = parseInt(num, base);
let new_num = dec_num.toString(new_base);
document.getElementById("converted").value = new_num;
console.log(`BASE ${base}: ${num} ==> BASE ${new_base}: ${new_num}`);
} catch (RangeError) {
console.log(`One or more bases is not in the range of 2 to 36.`);
}
}