JavaScript code to detect variable

Source code

/*******
undefined is classified as a primitive value. Your ability to use undefined will be extremely dependent upon the type and version of your browser.

1. It can refer to a variable that has never been declared. 
2. Or it can refer to a variable that has been declared, but has not been assigned a value. 

3. undefined is also a type. You can use the typeof operator to determine the type of a variable and it will return a type of "undefined" for an undefined variable. 
****/

var t1=""; //decleared has value
var t2; //declered has no value
//t3; not decleared

if (t1!=undefined) {alert("t1 has value, is defined")}

//value is not defined
if (t2==undefined) {alert("t2 has no value, is undefined")}

//varible is not defined
if (typeof(t3) == "undefined") {alert("t3 is not decleared")}


document.write("
t3 is of type = " +typeof (NotThere) );