Determines the ordinal number appropriate to the passed cardinal number.

Syntax

JSV_ordinalSuffix(expCN [, suffixOnly])

Prototype

expCN.ordinalSuffix([suffixOnly])

Returns

The ordinalSuffix function returns the appropriate ordinal number for the selected cardinal number. If the optional argument suffixOnly is passed, then only the suffix is returned.

Parameters

The ordinalSuffix function uses the following arguments.

Argument Description
expCN A cardinal number
suffixOnly Optional. Boolean value that indicates whether the ordinal suffix (e.g., st) only should be returned. Default value is false.

Remarks

ordinal number n (1607) 1 : a number designating the place (as first, second or third) occupied by an item in an ordered sequence 2 : a number assigned to an ordered set that designates both the order of its elements and its cardinal number

cardinal number n (1591) 1 : a number (as 1, 5, 15) that is used in simple counting and that indicates how many elements there are in an assemblage 2 : the property that a mathematical set has in common with all sets that can be put in one-to-one correspondence with it

-- Webster's Ninth New Collegiate Dictionary

Dependencies

n/a

Example

The following lines of code

var f = 54;
document.write( 
    "The cardinal number " + f + 
	" is written as the ordinal number " + 
    f + JSV_ordinalSuffix(f,true) );
var i = 0;
for (i=0; i<22; i++) {
    document.write( i + JSV_ordinalSuffix(i) + " " );
}

produce

The cardinal number 54 is written as the ordinal number 54th

0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st