#10 JavaScript Tutorial | Switch case

Опубликовано: 22 October 2018
на канале: Telusko
171,014
1.7k

You can use multiple if…else…if statements to perform a multiway branch. However, this is not always the best solution, especially when all of the branches depend on the value of a single variable. Starting with JavaScript 1.2, you can use a switch statement which handles exactly this situation, and it does so more efficiently than repeated if…else if statements.
The switch case statement in JavaScript is also used for decision making purposes. In some cases, using the switch case statement is seen to be more convenient over if-else statements. Consider a situation when we want to test a variable for hundred different values and based on the test we want to execute some task. Using if-else statement for this purpose will be less efficient over switch case statements and also it will make the code look messy.
For Program code, info & more resources checkout this article - https://simplesnippets.tech/javascrip...
Video by - Tanmay Sakpal
Simple Snippets Channel link -    / simplesnippets  


На этой странице сайта вы можете посмотреть видео онлайн #10 JavaScript Tutorial | Switch case длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Telusko 22 October 2018, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 171,014 раз и оно понравилось 1.7 тысяч зрителям. Приятного просмотра!