Formats the value of a dollar amount rounding the number to two decimal places.

Syntax

JSV_dollarFormat(expD)

Prototype

expD.dollarFormat()

Returns

The dollarFormat function returns the string representation of a dollar amount rounding the number to two decimal places. If the value is negative, then the returned formatted dollar value is positive and enclosed in parentheses.

Parameters

The dollarFormat function uses the following arguments.

Argument Description
expD The dollar amount that is to be formatted.

Remarks

n/a

Dependencies

JSV_round

Example

The following lines of code

var f = -32.9876;
document.write( "The dollar amount " + f + 
    " is formatted as " + 
    JSV_dollarFormat(f) );
var f = -1.4786;
document.write( "The dollar amount " + f + 
    " is formatted as " + 
    JSV_dollarFormat(f) );

produce