Hex to Binary

Published by christos Merinopoulos in

Create a function that will take a HEX number and returns the binary equivalent (as a string).

Examples

toBinary(0xFF) ➞ "11111111"

toBinary(0xAA) ➞ "10101010"

toBinary(0xFA) ➞ "11111010"

Notes

The number will be always an 8-bit number.

Watch a quick demo on how Edabit works.