← Back to challenges

Return the End Letters of Numbers

JavaScriptHardcontrol_flowstringsnumbers

Instructions

Create a function that takes an integer and returns it as an ordinal number. An Ordinal Number is a number that tells the position of something in a list, such as 1st, 2nd, 3rd, 4th, 5th, etc.

Examples

returnEndOfNumber(553) ➞ "553-RD"

returnEndOfNumber(34) ➞ "34-TH"

returnEndOfNumber(1231) ➞ "1231-ST"

returnEndOfNumber(22) ➞ "22-ND"

returnEndOfNumber(412) ➞ "412-TH"

Notes

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: RNA Reverse Complement