E-CODING JAVA Study Guide - Switch Statement
Document Summary
Control structures in javascript are used to control the flow of execution in a program. They are used to make decisions, repeat code, and handle errors: conditional statements - in javascript, conditional statements are used to make decisions based on conditions. The most common conditional statement is the if statement, which executes a block of code if a condition is true. The if statement can be followed by an else statement to execute a different block of code if the condition is false: loops - in javascript, loops are used to repeat code until a condition is met. The most common loop structures are the for loop and the while loop. The switch statement evaluates an expression and compares it to a series of case labels. If a match is found, the corresponding code block is executed: try-catch statement - in javascript, the try-catch statement is used to handle errors.