Javascript - How to find datatype of variable, Typeof() function
How to find datatype of variable
How to find type of variable name?
Javascript has a special function called typeof which prints the datatype of a variable. When you do code some time the error may be triggered because improper useage of datatype. In such scenario you can use the typeof function to the the data type of the variable.
var strng = "I Love You"; var arry = new Array("Me", "too"); alert(typeof(strng)); // alerts as 'string' alert(typeof(arry)); // alerts as 'object'
The first alert message prints the datatype as string.
The second alert message prints the datatype as object.
The topic on Javascript - How to find datatype of variable is posted by - Parthi
Hope you have enjoyed, Javascript - How to find datatype of variableThanks for your time