- 3
Guys Please someone should explain switch statement more easy for me please
I don't understand the switch statement
11 ответов
+ 1
Is getDay an inbuilt word in JS
+ 1
Kwabena Karikari Affum I have explained to you as much as I can .
0
Amogha what is that new Date().get day()
0
Kwabena Karikari Affum Switch statement is just like if statement.
A switch statement first evaluates its expression. It then looks for the first case clause whose expression evaluates to the same value as the result of the input expression (using the strict comparison, ===) and transfers control to that clause, executing the associated statements. (If multiple cases match the provided value, the first case that matches is selected, even if the cases are not equal to each other.)
If no matching case clause is found, the program looks for the optional default clause, and if found, transfers control to that clause, executing the associated statements. If no default clause is found, the program continues execution at the statement following the end of switch. By convention, the default clause is the last clause, but it does not need to be so.
The optional break statement associated with each case label ensures that the program breaks out of switch once the matched statement is executed and continues execution
0
Amogha I get you the getDay is an inbuilt word for getting the current day from 0-6 which means 0 is Sunday
- 1
So get day is inbuilt . Without getDay will the code work
- 1
Matiyas this doesn't explain it to me