[Javascript] to determine whether a positive integer

 

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

 

Guess you like

Origin www.cnblogs.com/xiaostudy/p/11936907.html