I sm havi problem o run this code please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I sm havi problem o run this code please help

function third(){ switch (C) {case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12 :alert("Thanks for giving your class"); break; default:alert("Evter a valid class") return third();};} third();

15th May 2021, 12:08 PM
Question Mark
Question Mark - avatar
8 Answers
+ 1
Insert let C... to your function, delete return third(), add all cases for case 1...11. cases should be like / case '1': case '2': / becouse prompt give you string value
15th May 2021, 1:06 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Thanks very much
15th May 2021, 1:22 PM
Question Mark
Question Mark - avatar
0
I am having problem to run this code
15th May 2021, 12:08 PM
Question Mark
Question Mark - avatar
0
Hi! Just put to the function parameter.
15th May 2021, 12:22 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Really let I try
15th May 2021, 12:29 PM
Question Mark
Question Mark - avatar
0
It is not working appropriate or well please once you also try
15th May 2021, 12:32 PM
Question Mark
Question Mark - avatar
0
you don't have a C variable defined inside the function. you didn't initialize it
15th May 2021, 12:33 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
let C =prompt("Write your class"); function third(){ switch (C) {case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12 :alert("Thanks for giving your class"); break; default:alert("Evter a valid class") return third();};} third();
15th May 2021, 12:35 PM
Question Mark
Question Mark - avatar