Mega Code Archive

 
Categories / JavaScript Tutorial / Operators
 

Typeof a variable

< html> <head> <title>Debug Example</title> <script type="text/javascript"> function aFunction(iNum1) {     if (typeof iNum1 == "number" ){        alert("number");     }     if ( typeof iNum1 == "string") {         alert("string");     } } aFunction("a"); aFunction(1); </script> </head> <body> </body> </html>