9687 return t.nextClause(), e.QueryParser.parsePresence
9688 default:
9689 n = "Unexpected lexeme type '" + s.type + "'"
9690 throw new e.QueryParseError(n, s.start, s.end) 9691 }
9692 }
9693 }),
9686 case e.QueryLexer.PRESENCE:
9687 return t.nextClause(), e.QueryParser.parsePresence
9688 default:
9689 n = "Unexpected lexeme type '" + s.type + "'" 9690 throw new e.QueryParseError(n, s.start, s.end)
9691 }
9692 }
9659 return t.nextClause(), e.QueryParser.parsePresence
9660 default:
9661 n = "Unexpected lexeme type '" + s.type + "'"
9662 throw new e.QueryParseError(n, s.start, s.end) 9663 }
9664 }
9665 }),
9658 case e.QueryLexer.PRESENCE:
9659 return t.nextClause(), e.QueryParser.parsePresence
9660 default:
9661 n = "Unexpected lexeme type '" + s.type + "'" 9662 throw new e.QueryParseError(n, s.start, s.end)
9663 }
9664 }
9607 return e.QueryParser.parseTerm
9608 default:
9609 n = "expecting term, found '" + s.type + "'"
9610 throw new e.QueryParseError(n, s.start, s.end) 9611 }
9612 }
9613 }),
Variables should be used inside of their binding context.
This helps avoid difficult bugs with variable hoisting.
It is a bad practice to use var
declarations because variables declared using var
can be accessed in a function-wide scope.
They can even be accessed before declaration.
In such cases, their value would be undefined
because only declarations and not initializations are hoisted.
function doIf() {
if (cond()) {
var build = true;
}
console.log(build);
}
function doIfElse() {
if (cond()) {
var build = true;
} else {
var build = false;
}
console.log(build)
}
function doIf() {
let build;
if (cond()) {
build = true;
}
console.log(build);
}