JAVASCRIPT VARIABLE DECLARATION CHECK

There are times when we need to call javascript functions that exist on different files that may not be loaded yet. In such cases we'll need to check if that variable is defined.
1
2
3
if (typeof(var1) == "undefined") {
// write code here...
}
1Firefox v38.0.5 as of 6/21/2015
2Internet Explorer v11
3Chrome v41 as of 4/11/2015
4Safari