Check out example codes for "typescript number to hex string". It will help you in understanding the concepts better.

Code Example 1

var g: number = 255;
alert(g.toString(16));

Learn ReactJs, React Native from akashmittal.com