filmov
tv
JavaScript - Conditional Statement: Switch

Показать описание
Hey guys, in this video we will learn about Switch Conditional Statement in JavaScript.
Practice Problems:
================
Answer the following questions. Try these in codepen and share the codepen URL in the comment section below. Best of Luck!!
Q.
var monthNumber = 3;
Write a program to print the number of days in a month using a switch case. Change the value of monthNumber and check if your code works fine.
Example: monthNumber = 3
Output:
---------------
Month = March
Total number of days = 31
Q.
var enteredAlphabet = 'd'
Write a program to check vowel or consonant using switch case. Change the value of enteredAlphabet and checkc if your code works fine.
Example: enteredAlphabet= c
Output: 'c' is consonant
Q.
var enteredNumber = 41
Write a program to check even or odd number using switch case. Change the value of enteredNumber and check if your code works fine.
Example: enteredNumber = 41
Output: 41 is an odd number
My Twitter Handle: @qaifikhan