Convert Decimal

Convert Decimal

Write a JavaScript function to convert a decimal number to binary, hexadecimal or octal number.

Example outputs:

console.log(dec_to_bho(654321,'B'));
"10011111101111110001"
console.log(dec_to_bho(654321,'H'));
"9fbf1" 
console.log(dec_to_bho(654321,'O'));
"2375761"