Your Open Source

 
Related Links

JavaScript

IsNumeric and IsNan function in JS

IsNumeric function used to check the numeric or not.

isNaN function used to check the value is a number or not. If the values is numeric its return true else returned false.


Syntax :

bool IsNumeric(string)


Code :
function IsNumeric(val) {

if (isNaN(parseFloat(val))) {
return false;
}
return true
}

  • hits 43181
  • datetime Aug 28 08 03:26:52
  • author Sekar
  • rating

Rating : 12345

Comments


gummed
Dec 06 09 02:30:02
This function is much better:

function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}


See http://dl.dropbox.com/u/35146/js/tests/isNumber.html
for details

mugdha
Oct 10 09 12:07:55

nice tution

Quick Reply or Comments

Preview
Your Name:
Your Reply :
<> is a code tag
Enter the verification code: