Posts

Showing posts with the label switch keyword

Learn JavaScript : Switch statement (Part 7)

Image
  Introduction Hello dev, welcome to our next tutorial on JavaScript. We will be learning how to use the switch keyword in this awesome programming language. Kindly note that; it is very important you learn the previous parts if you want to fully understand how to code in JavaScript. If you are just looking forward to revising the switch statement, then it is okay to follow this tutorial. The switch keyword is similar to if...else if...  statement as we had previously looked at. But it is more convenient than if..else if.. statement because it can be used with characters and numbers amongst other types.  Just like a condition function, the block of code associated with the case keyword will be executed if the case's value satisfies the result of the main condition or expression . If none of the cases satisfy the main expression then the block of code associated with the default keyword is executed. There is also the break keyword at the end of every cas...

followers