【javascript】判断是否为正整数

function isNormalInteger(str) {
    var n = Math.floor(Number(str));
    return n !== Infinity && String(n) === str && n > 0;
}

猜你喜欢

转载自www.cnblogs.com/xiaostudy/p/11936907.html