I have the following code:
const myNumber: number = 0xFFFFFF;
How can I convert myNumber
to '#FFFFFF'
?
Just use toString()
method and a #
const myNumber: number = 0xFFFFFF;
const hexString: string = '#' + myNumber.toString(16); // '#ffffff'