Here user can enter either phone number or mobile number. Here user can enter either 10 digit number(which starts from 9) OR can enter 8 digit number(starts with 2). This function first determines the ASCII code of the keyboard key and then verifies that its ASCII code is within the range 48 to 57.
Integer(0); // true Integer(1); // true Integer(-100000); // true Integer(0.1); // false Integer(Math. In the ECMAScript specification, they only exist conceptually: All numbers are always floating point and integers are ranges of numbers without decimal fractions (for details, consult “Integers in Java Script” in “Speaking Java Script”).In this blog post, I explain how to check whether a value is an integer.Remember it is always necessary to validate form input values using a server-side script to cater for non-Java Script browsers or exploit attempts.This example goes one step futher and also checks that the number entered is valid according to the Luhn algorithm (also known as the "mod 10" algorithm).