Want to check if a variable is an integer in JavaScript? You can try to run the following code to check the existence of an integer:
1 2 3 4 5 6 7 8 9 10 11 12 13 | <html> <head> <script> var a = 10; if (a === parseInt(a, 10)) alert("Integer!") else alert("Not an integer!") </script> </head> <body> </body> </html> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.