1//typeof() will return the type of value in its parameters.
2//some examples of types: undefined, NaN, number, string, object, array
3
4//example of a practical usage
5if (typeof(value) !== "undefined") {//also, make sure that the type name is a string
6 //execute code
7}
1console.log(typeof 93);
2// Output = "number"
3
4console.log(typeof 'Maximum');
5// Output = 'string'
6
7console.log(typeof false);
8// Output = "boolean"
9
10console.log(typeof anUndeclaredVariable);
11// Output = "undefined"
1typeof("iAmAString");//This should return 'string'
2//NO camelCase, as it is a JS Keyword
1var x = 12345;
2console.log(typeof x) // number
3x = 'string';
4console.log(typeof x) // string
5x = { key: 'value' };
6console.log(typeof x) // object
1var someValue = 'this is string';
2console.log(typeof(someValue)); // this will return string