Java Script vs Switch Statement conversation
Hello MemberI have assignment of my class and I need to be solution so please read the question and answer with details,
You need to study the following Javascript code carefully. Write the below code without if-else to do the same job by using Switch Statement?
1 . If (MousePosition="Div1") {
2. Alert("Div1");
3. } else {
4. If(MousePosition="Div2") {
5. Alert("Div2");
6. } else {
7. If(MousePosition="Div3") {
8. Alert("Div3");
9. } else {
10. If(MousePosition="Div4") {
11. Alert("Div4");
12. } else {
13. If(MousePosition="Div5") {
14. Alert("Div5");
15. } } } } }
Please provide solution of the above code.