The switch statement executes a block of code depending on different cases . The switch statement is a part of JavaScript’s “Conditional” Statements, which are used to perform different actions based on different conditions. Use switch to select one of many blocks of code to be executed.