I want to Convert Ordinal String to its number e.g
- "1st" to 1
- "2nd" to 2
- "3rd" to 3
...
Tried this function but return its ordinal, not the number
function nth(n){return["st","nd","rd"][((n+90)%100-10)%10-1]||"th"}
it should be the inverse of this function