Python Short Circuit Evaluation Javascript