Javascript 检查字符串是否是数字的几种方法
Javascript 检查字符串是否是数字的几种方法























两种方法都可以检查参数是否为数字。
第一种使用正则表达式检查,对于检查的内容更加灵活,但显得麻烦;
第二种方法,直接调用系统的isNaN() ,对所有数字均有效,简单快捷!
Javascript 检查字符串是否是数字的几种方法
两种方法都可以检查参数是否为数字。
第一种使用正则表达式检查,对于检查的内容更加灵活,但显得麻烦;
第二种方法,直接调用系统的isNaN() ,对所有数字均有效,简单快捷!