How to find type of variable name?

by Sanju 2009-10-01 09:44:56

Find type of variable name

To find the type of variable name use typeof().

JavaScript typeof operator tells you what type of data you're dealing with:

Example :

var str1 = "This is a string"
var arr1 = new Array("This", "is", "a", "string");

alert(typeof(str1)); // shows 'string' in the message box
alert(typeof(arr1)); // shows 'object' in the message box

Tagged in:

1532
like
0
dislike
0
mail
flag

You must LOGIN to add comments