helloterry8,
var string = '0123456789ABCDEF';
var result = '';
while (chislo) {
result = string[chislo % vihod] + result;
chislo = Math.floor(chislo / vihod);
}
обратно:
var string = '0123456789ABCDEF';
var result = 0;
var index = chislo.length;
while (index) {
result += Math.pow(vhod, chislo.length - index--) * string.indexOf(chislo[index]);
}