javascript tostring 16 format 2 hexa places code example
Example 1: javascript convert number to hex
hexString = yourNumber.toString(16);
Example 2: javascript convert number to hex
yourNumber = parseInt(hexString, 16);
hexString = yourNumber.toString(16);
yourNumber = parseInt(hexString, 16);