Mega Code Archive

 
Categories / JavaScript DHTML / Data Type
 

Use typeof to check the type for different type variables

<html> <head> <title></title> </head> <body> <script type="text/javascript"> var num1 = 1; var num2 = 1; var num3 = 19; var value = "84"; var name1 = "A"; var name2 = "BB"; alert(typeof num1); alert(typeof num2); alert(typeof num3); alert(typeof value); alert(typeof name1); alert(typeof name2); </script> </body> </html>