Reputation: 414
if (!variable) ui.notify('functionality not available due to...');
When doing this simple check in IE we get SCRIPT5009: 'variable' is undefined, where it is exactly what we are trying to check but not fail so disgracefully. How to make this graceful fail come true?
Upvotes: 0
Views: 603
Reputation: 8230
Next code can help you:
if (typeof variable === "undefined") console.log("undefined");
else console.log("defined");
Upvotes: 3
Reputation: 16605
You can try:
if (!window['variable']) ui.notify('functionality not available due to...');
assuming that variable
is global
Upvotes: 1