JavaScript判断用户输入的是不是正整数

一个比较基础的验证
一行代码搞定
不过我这还是写成个方法吧

const VerifyInteger = function(value) {
    
    
    return /(^[1-9]\d*$)/.test(value);
}

猜你喜欢

转载自blog.csdn.net/weixin_45966674/article/details/123550746