JavaScript Tutorial 14 - Switch Statements in JavaScript

preview_player
Показать описание

Switch statements are similar to 'If' statements but they are neater when working with many conditions. Make sure you use the break statement at the end of each case so that the code runs efficiently. If you don't use the break statement, the program will keep checking through all conditions even if a match has already been found. If none of the conditions are met, then the default case will run. This video tutorial explains how to use switch statements.
Рекомендации по теме