|
Number.percentFormat Method
Formats a Number according to a specific, user-defined percent format.
object.percentFormat ([NumDigitsAfterDecimal[, IncludeLeadingDigit[, UseParensForNegativeNumbers[, GroupDigits]]]])
Arguments
- object
- Required. Always the name of a Number object.
- NumDigitsAfterDecimal
- Optional. Numeric value indicating how many places to the right of the decimal
are displayed. If omitted, the original number of places to the right of the
decimal is used.
- IncludeLeadingDigit
- Optional. Boolean value that indicates whether or not a leading zero is
displayed for fractional values. Default is false.
- UseParensForNegativeNumbers
- Optional. Boolean value that indicates whether or not to place negative
values within parentheses. Default is false.
- GroupDigits
- Optional. Boolean value that indicates whether or not numbers are grouped. Default is false.
Return Value
The Number.percentFormat() method returns a string containing the number in the specified format.
Remarks
The following example illustrates the use of the Number.percentFormat method.
Alert(varNum.percentFormat(2, true, true, true));
Requirements
Number.format()
|