Conditional Branching in JavaScript