javascript switch case with two conditions