Challenge 33

🎨

Denary <-> Hexadecimal

Open in Code Editor or Copy Instructions

Create 2 functions denToHex and hexToDen to convert denary numbers to hexadecimal and vice-versa respectively. The hexadecimal numbers can be represented as strings

Examples:

denToHex(50) would return "32"

hexToDen("7F") would return 127

Extension:

Test your functions work by looping from hex 00 to FF and outputting their denary equivalent

Add support for signed numbers - i.e. "FF" would no longer be 255...but now -1