Posted By

1man on 11/18/07


Tagged

default Switch case statement


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


Simple Switch Statement


 / Published in: JavaScript
 

Very basic switch statement.

  1. function switchTest(x){
  2. switch(x){
  3. case 1:
  4. console.log("x equals 1");
  5. return x;
  6. case 2:
  7. console.log("x equals 2");
  8. return x;
  9. case 3:
  10. console.log("x equals 3");
  11. return x;
  12. default:
  13. console.log("x doesn't equal 1 to 3");
  14. return x;
  15. }
  16. }

Report this snippet  

You need to login to post a comment.