Which method of checking if a variable has been initialized is better/correct? (Assuming the variable could hold anything (string, int, object, function, etc.))
Short way to test a variable is not declared (not undefined) is
if (typeof variable === "undefined") { ... }
I found it useful for detecting script running outside a browser (not having declared window variable).
window