What would the function be for when the user inputs, it converts the input to both hex and binary?
The algorithm for converting from decimal to binary is this:
Take your decimal number and determine the remainder if you divide that number by two. The remainder is now the bit in your ONES (2^0) place. Hint: the modulo operator % will give you the REMAINDER of a division. For example, 5%2 is 1 because the remainder of dividing 5 by 2 is 1. 4%2 is 0, because there is no remainder.
Now, we're going to update your decimal number: divide the decimal number and round down to get your NEW decimal number
var hexLetters = "0123456789ABCDEF".split("");
var decimalNum = Number(window.prompt("Enter a decimal number to convert"));
var binaryNum= "";
* binary conversion *
console.log("The number " + decimalNum + " in binary is: ")
console.log(binaryNum);
var hexNum = "";
*binary conversion*
/************************************* */
console.log("The number " + decimalNum + " in hexadecimal is: ")
console.log(hexNum);
What would the function be for when the user inputs, it converts the input to both hex and binary