Check if switch is on via script

I have attempted to do it two ways, neither of which has worked.

Window_MenuCommand.prototype.isIngame = function() { return $gameSwitches[1] === true; // Second approach: return $gameSwitches[1]};Can anyone lend a hand? Thanks in advance!

edit: tried double equals ($gameSwitches[1] == true😉 still doesn't work.
Nevermind- found it.

The proper way to call it is 

Code:
$gameSwitches.value(1);

Original thread: https://forums.rpgmakerweb.com/threads/check-if-switch-is-on-via-script.49722/