See also: decToBin, decToOct

Converts a decimal number (i.e., integer) to a hexadecimal number string.

Syntax

JSV_decToHex(expD)

Prototype

expD.decToHex()

Returns

The decToHex function returns the hexadecimal number string of the decimal number.

Parameters

The decToHex function uses the following arguments.

Argument Description
expD The decimal number that is to be converted to a hexadecimal number.

Remarks

There is no checking whether expD is a integer. Users of this function should also use the isInteger function to check that the value of expD is a valid argument to this function.

Uses the toString method of the Number object to return a string representing the specified Number object.

Dependencies

n/a

Example

The following lines of code

var f = 43;
document.write( "The number " + f + " is hexadecimal " + JSV_decToHex(f) );
f = 54;
document.write( "The number " + f + " is hexadecimal " + JSV_decToHex(f) );

produce