Conditional Variable for Javascript