JavaScript verifique se Boolean é indefinido
if (typeof myFlag !== "undefined") {
// comes here whether myFlag is true or false but not defined
}
Scriper
if (typeof myFlag !== "undefined") {
// comes here whether myFlag is true or false but not defined
}