var n = Number(str) if (!isNaN(n)) { // 数字 } else // 字符 { } View Code 转载于:https://www.cnblogs.com/zecVip/p/4791955.html