There is a global function that I have defined:
GlobalFunctions = {
something: function() {
}
};
I am aware of how to check if a function exists using:
if (typeof functionName == "function")
or the preferred method:
if (typeof functionName === "function")
However, even though the above methods work fine, when attempting to validate a global function, I encounter this error:
if (typeof GlobalFunctions.something == "function")
This results in the following error:
angular.js:12520 ReferenceError: GlobalFunctions is not defined
at r.$scope.continueLogout (my-app.js:197)
at b.$scope.logout (my-app.js:243)
at fn (eval at compile (angular.js:13365), <anonymous>:4:209)
at e (angular.js:23613)
at b.$eval (angular.js:16052)
at b.$apply (angular.js:16152)
at HTMLAnchorElement.<anonymous> (angular.js:23618)
at HTMLAnchorElement.dispatch (jquery.min.js:3)
at HTMLAnchorElement.q.handle (jquery.min.js:3)
I tried searching on Google for solutions related to global functions, but found only solutions for regular functions.
Hope that explanation was clear, thank you.