JavaScript Switch Statement

he switch statement is used to perform different actions based on different conditions. Switch Statement Use the switch statement to select one of many code blocks to be executed. Syntax switch(expression) { case n:         code block         break; case n:         code block         break; default: code block } This is how it works: The switch […]

JavaScript If…Else Statements

Conditional statements are used to perform different actions based on different conditions. Conditional Statements Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. In JavaScript we have the following conditional statements: Use if to specify a block of code to […]