简体   繁体   中英

How can I validate if a given number is integer or not in Javascript?

I'm currently validating a form with JavaScript in which the user has to type their id number . I already figure out how to validate if the value is numeric, but I'm struggling to find a way to validate if the given number is integer or not.

尝试这个:

Number.isInteger(Number(input))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM