The reason it fails (it shouldn't be failing silently, it should be throwing an exception) is that you're trying to retrieve a value from a symbol (today) that may not be defined.
Try this:
if (typeof today == 'object' && today.okay) {
// It's there
}
else {
// It's not there
}
Alternately, of course, you can just handle the exception:
try {
if (today.okay) {
// 'today' is defined and 'okay' is truthy
}
else {
// 'today' is defined, but 'okay' is not truthy
}
}
catch (e) {
// 'today' is undefined
}
My impression is that most JavaScript engines are very fast when it comes to throwing exceptions (this is not true of all environments), but if you anticipate this condition being not unusual (not exceptional), then I would handle it with inline logic, not an exception. Exceptions are for exceptional conditions.