Tell us what’s happening:
This is the only post on this at the current time. But what is going on with this , where is the code wrong…
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
case "default":
setPlayerCards();
break;
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Learn Modern JavaScript Methods by Building Football Team Cards - Step 45
Hi!
The default
doesn’t need quote marks nor the case
. Also you aren’t need the break
after default
clause.
But all the other cases have it…
Teller
December 25, 2024, 6:22pm
4
Hi @booleanmethod9
In a switch
statement, the break
keyword is placed to stop the execution of the rest of the code. So after a specific case
is selected, it runs the code from top to bottom. Otherwise the code from the next case(s) will execute.
Since default
is when none of cases are selected, there is no need to include the break
keyword.
Happy coding
but why is there no quotation marks with default
Because It’s a default case
. Have you ever seen any quote marks around the switch case
keyword within the previous challenge’s?
system
Closed
June 26, 2025, 6:30am
7
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.