top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can i know that a variable is a number or not using a Javascript ?

+2 votes
511 views

Is there any way so that i will get to know about my variable is a number or not without using Javascript?

posted May 1, 2014 by Sachin Dahda

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Looks that you want to know that variable is a number or not using PHP?

1 Answer

0 votes

I guess he mean to say without using Javascript.

Yes there's a way you will get to know about this:

  • bool is_numeric( mixed var)
    Returns TRUE if var is a number or a numeric string, FALSE otherwise.

Or there is another way

  • The isNaN() function is used to check if a value is not a number.

Syntax:
isNaN(number)

Parameter Description:
number Required. The value to be tested

answer May 3, 2014 by Mohit Sharma
Similar Questions
0 votes

As per my understanding of interpreted language is scripting(interpreted) language is the language which can executed by CPU straight away without any need of compilation are classified as scripting language

Now if i take example of JavaScript , it does not requires explicit compilation from developer. But browser which interprets actually converts it in to machine instruction which CPU can execute.

So in a way it is also a compiled language though compilation is not required by developer explicitly but browser does it internally. Is n't it ?

Same is the case with PHP.

+2 votes

I know it is possible via IE (ActiveX objects).
Can we do this with all browsers ? (Specially in FireFox)

...