I wanted to check whether the variable is defined or not. For example, the following throws a not-defined error
alert( x );
How can I cat
You can also use the ternary conditional-operator:
var a = "hallo world"; var a = !a ? document.write("i dont know 'a'") : document.write("a = " + a);
//var a = "hallo world"; var a = !a ? document.write("i dont know 'a'") : document.write("a = " + a);