What happen if default case come before the normal case in swtich-involved code?

Hi, I wonder what happen if default case come before the normal case in swtich-involved code?
For example, what if I have the following code:


swtich(myLetter){
  case 'A':
  console. log('hello')
  default:
  consol.log('good morning')
  case 'B':
  console.log('byebye')
}

hi @xiaobaibai663 ,

thanks for inquiring such question in the community. Appreciate it.

As you start to post more questions, please bear in mind to at least write proper syntax for general readability for the majority. Thanks.

To answer your question, you can refer to the documentation helpfully provided by MDN Web Docs - Switch( ). Over here will explain clearly whether does it have any impact.

Thank you once again.

what syntax did I write that is inproper?

Could you try copy and paste your codes in a compiler and see what shows up? E.g., spelling, missing keywords, etc

From there, you’ll understand what’s missing. Hope the hints are clear enough.