If you really want ordinal numbers, you don't need to use an array because it's a messy way of doing it for the reasons I posted before. There are lots of examples on google - pick one
This is the function I have been using for ages now. Just call it in the example I posted wherever you want an ordinal number.
Code:
function getOrdinalNumber(n) {
var s=["th","st","nd","rd"],
v=n%100;
return n+(s[(v-20)%10]||s[v]||s[0]);
}
HungryChapstick - just ignore the guy. That post is stupidly inappropriate. He knows perfectly well that you could not submit that code as your student homework, nor even explain it probably, and is only trying to show off how amazingly clever he is, and increase his post count (he has a lot of leeway to make up after being banned from the forum so often).
I expect he will retort with some jejeune rubbish like "I think the OP can decide for him/her self if the example I posted is correct, useful or whatever to them."
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
I expect he will retort with some jejeune rubbish like "I think the OP can decide for him/her self if the example I posted is correct, useful or whatever to them."
I don't have to. You did it for me with the red bit
Then how come the mods haven't removed any of my posts?
It's probably because they don't agree with you.
Mods do not remove posts that are merely incorrect or even silly. They only remove posts which are insulting or abusive - as you yourself know well from long experience of being banned for exactly that.
Perhaps the mods have not removed any of my posts because they do agree with me!
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.