IsNumeric Function for JavaScript

Results 1 to 3 of 3

Thread: IsNumeric Function for JavaScript

  1. #1
    Victor Brief Guest

    Default IsNumeric Function for JavaScript

    I am wondering if there is a isnumeric function for JavaScript.<BR><BR>Thanks in advance.

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: IsNumeric Function for JavaScript

    Well, there kind of is... you can write your own<BR><BR>function isNumeric(n)<BR>{ return !isNaN(parseInt(n)); }<BR><BR>Let&#039s say you have a variable blah, and you want to see if it&#039s a number. Do:<BR><BR>if (isNumeric(blah))<BR>// do something...<BR><BR>Hope this helps!<BR><BR>Let me also recommend that you check out:<BR><BR>http://www.4guysfromrolla.com/webtech/vb2java.shtml

  3. #3
    Ian Stallings Guest

    Default RE: IsNumeric Function for JavaScript

    yes it&#039s called isNAN (not a number)<BR>it returns true if it&#039s not a number, false if<BR>otherwise.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •