1if (typeof myVar === 'integer'){
2 //I am indeed an integer
3}
4
5if (typeof myVar === 'boolean'){
6 //I am indeed a boolean
7}
1var booleanValue = true;
2var numericalValue = 354;
3var stringValue = "This is a String";
4var stringObject = new String( "This is a String Object" );
5alert(typeof booleanValue) // displays "boolean"
6alert(typeof numericalValue) // displays "number"
7alert(typeof stringValue) // displays "string"
8alert(typeof stringObject) // displays "object"
9