js中如何给出一个数判断th,st,nd

如何判断数字的后缀名
js中如何给出一个数判断th,st,nd

什么意思,是你有数字,加上这些
if (num % 10 == 1) result = num + "st";
else if (num % 10 == 2) result = num + "nd";
else if (num % 10 == 3) result = num + "rd";
else result = num + "th";
从字符串里面去掉直接subString就可以了

没太明白你到底是什么意思