nodejs-course/lessons/18-switch at main · DucMinhNe/nodejs-course · GitHub
Skip to content

Latest commit

 

History

History

18-switch

Folders and files

README.md

Lesson 18: switch statement

Multi-way branch on a single value.

What you'll learn

  • matches with ===
  • break prevents fall-through
  • intentional fall-through groups cases
  • default handles the rest

Example

See examples/.

Exercise

Convert an if/else chain of 4 branches into a switch.