Given a value, returns that value as a Percent.
- value - the Number, Percent, or String value to be converted to a Percent.
- places - the number of decimal places of the returned Percent value.
- Return type: Percent
percent(50/100) returns 50%.
percent(0.75) returns 75%.
percent(0.5667777, 3) returns 56.678%.
Supported data types
If a Number value is passed, a Percent will be returned only if the Number value is represented using division, ex. 50/100, or if it is a decimal.
If a Percent value is passed, the same Percent value will be returned.
If a String value is passed a Percent will be returned only if the String value can be converted to a Number value, and that Number value is a decimal.
Unsupported data types
Unsupported data types return Null.
Updated 03 May 2023
Did this page help you?