0

J.S. HELP: using switch + if statement

var day; switch (new Date().getDay()){ case 0: day = "Sunday."; break; case 1: day = "Monday"; break; case 2: day = "Tuesday"; break; case 3: day = "Wed"; Break; Document.getEl...("Elem1").innerHTML=day -- - ------------ -- -- -- Now, I want to add an if statement to say if its case 1, 2, 3, document.getEl..("Elem2).innerHTML = " some text ". Im trying to group case 1, 2, and 3. So it's kind of like, when it's the Sunday elem1.innerHTML = " Sunday". When it's the week, Elem2.innerHTML="text"

21st Jun 2019, 9:36 PM
Ginfio
Ginfio - avatar
1 Odpowiedź
+ 2
On elem 1, it will still display case 0, 1, 2, 3, like normal elem2 is a different one, it only groups 1,2, and 3. and displays text. it ignores 0.
21st Jun 2019, 9:38 PM
Ginfio
Ginfio - avatar