filmov
tv
How do you return the word equivalent of a number? #javascript #coding #tutorial

Показать описание
How do you return the word equivalent of a number? #javascript #coding #tutorial
The switch statement can help with this. It compares an expression against the case clauses.
switch (expression) {
case Expression1:
statements
case Expression2:
statements
default:
statements
}
***SAMPLE CODE***
function switchCase(number){
switch(number){
case 1:
break;
case 2:
break;
case 3:
break;
default:
}
}
switchCase(2) // output: two
switchCase(4) // output: out of range #Shorts #youtubeShorts #trending #viral #quicktips #youtube #youtuber #Shortstiktok
The switch statement can help with this. It compares an expression against the case clauses.
switch (expression) {
case Expression1:
statements
case Expression2:
statements
default:
statements
}
***SAMPLE CODE***
function switchCase(number){
switch(number){
case 1:
break;
case 2:
break;
case 3:
break;
default:
}
}
switchCase(2) // output: two
switchCase(4) // output: out of range #Shorts #youtubeShorts #trending #viral #quicktips #youtube #youtuber #Shortstiktok