Is this a valid way to write the switch statement? var day; switch (day=3) { case 1: ... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Is this a valid way to write the switch statement? var day; switch (day=3) { case 1: ...

7th Nov 2016, 9:28 AM
Stoobius
2 Answers
0
yes it is and why do you think it will not work var day; switch(day=3) { case 1: document.write("google"); break; case 3: document.write("aditya"); break; } output is aditya
7th Nov 2016, 11:12 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
If you fix a value of a day variable, where is the need to use a case statement ?
7th Nov 2016, 1:34 PM
ctsofiane