Javascript examples for Statement:switch
Use switch case statement on number
<html> <head></head> <body> <div id="stars"></div> <script language="JavaScript"> html=''; num=4;/* www .j a v a 2s .c o m*/ switch(num) { case 5: html+="*"; case 4: html+="*"; case 3: html+="*"; case 2: html+="*"; case 1: html+="*"; } document.getElementById("stars").innerHTML=html; </script> </body> </html>