sussy-util / functions / toOrdinal
▸ toOrdinal(n
): string
Returns the given number as a string with an ordinal suffix indicating its position in an ordered sequence.
Example
// returns '1st'
getOrdinalSuffix(1);
Example
// returns '42nd'
getOrdinalSuffix(42);
Example
// returns '123rd'
getOrdinalSuffix(123);
Name | Type | Description |
---|---|---|
n |
number |
The number to be converted to an ordinal string. |
string
The ordinal string representation of the given number.