Day 30 JavaScript Switch Function Syntax

Day 30 a full month into learning how to code! I am grateful to have made it this far. However, I am still far away from where I need to be and question my speed of execution. I know at Lambda coding school I would be doing a lot more work on a daily basis. It is no time to falter behind with self-doubt, at the end of the day as long as I have a good foundation I will succeed at coding.

Now on to today’s syntax I want to memorize which is the “switch” statement. The “switch” statement can replace multiple “if” statements. Here is an example of the syntax.

switch(x) {
  case 'value1':  // if (x === 'value1')

  case 'value2':  // if (x === 'value2')


The code is cleaner and more readable. This syntax was easy for me to remember. Switch, case, break, and default.

Next important thing to highlight from today’s read is functions. Function play an important role in JavaScript, they are the main “building blocks” of the program. The syntax for creating a function is easy as well. Here is an example and a visual of the functions.

The new year just started and already 1 month into learning to code. 2019 is gonna be a great year!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Up ↑

%d bloggers like this: