I have a form where a user enters a decimal number and then from the dropdown menu he chooses if he wants to convert it either to binary, octal or hexadecimal by clicking on a c
Decimal to hex/oct/bin:
hex
oct
bin
const hex = (100).toString(16); // "64" const oct = (100).toString(8); // "144" const bin = (100).toString(2); // "1100100"
and same backwards:
const dec0 = parseInt("64", 16); // 100 const dec1 = parseInt("144", 8); // 100 const dec2 = parseInt("1100100", 2); // 100