I need switch statement

Hi!Everyone
I want to use a switch statement of JavaScript instead of this switch of C++ that I have used on the below code.Can anyone help by showing me how I can use the JavaScript switch statement instead of C++ one here.




var d=new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

if (weekday[d.getDay()]=="Monday")
{document.write("Monday-blue as can be")}
else if (weekday[d.getDay()]=="Tuesday")
{document.write("shfjksh")}
else if (weekday[d.getDay()]=="Wed")
{document.write("shfjksh")}
else if (weekday[d.getDay()]=="Tuesday")
{document.write("shfjksh")}
else if (weekday[d.getDay()]=="Tuesday")
{document.write("shfjksh")}
else if (weekday[d.getDay()]=="Thursday")
{document.write("yes")}
else if (weekday[d.getDay()]=="Tuesday")
{document.write("shfjksh")}




Any help or advice will be highly appreciated.

Eager Student

Comments

  • : Hi!Everyone
    : I want to use a switch statement of JavaScript instead of this switch of C++ that I have used on the below code.Can anyone help by showing me how I can use the JavaScript switch statement instead of C++ one here.
    :
    :
    :
    :
    : var d=new Date()
    : var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
    :
    : if (weekday[d.getDay()]=="Monday")
    : {document.write("Monday-blue as can be")}
    : else if (weekday[d.getDay()]=="Tuesday")
    : {document.write("shfjksh")}
    : else if (weekday[d.getDay()]=="Wed")
    : {document.write("shfjksh")}
    : else if (weekday[d.getDay()]=="Tuesday")
    : {document.write("shfjksh")}
    : else if (weekday[d.getDay()]=="Tuesday")
    : {document.write("shfjksh")}
    : else if (weekday[d.getDay()]=="Thursday")
    : {document.write("yes")}
    : else if (weekday[d.getDay()]=="Tuesday")
    : {document.write("shfjksh")}
    :
    :
    :
    :
    : Any help or advice will be highly appreciated.
    :
    : Eager Student
    :
    Check out this site: http://www.w3schools.com/js/js_conditionals.asp
  • Thank you very much for the link I high appreciate your help.
    Eager Student
    : : Hi!Everyone
    : : I want to use a switch statement of JavaScript instead of this switch of C++ that I have used on the below code.Can anyone help by showing me how I can use the JavaScript switch statement instead of C++ one here.
    : :
    : :
    : :
    : :
    : : var d=new Date()
    : : var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
    : :
    : : if (weekday[d.getDay()]=="Monday")
    : : {document.write("Monday-blue as can be")}
    : : else if (weekday[d.getDay()]=="Tuesday")
    : : {document.write("shfjksh")}
    : : else if (weekday[d.getDay()]=="Wed")
    : : {document.write("shfjksh")}
    : : else if (weekday[d.getDay()]=="Tuesday")
    : : {document.write("shfjksh")}
    : : else if (weekday[d.getDay()]=="Tuesday")
    : : {document.write("shfjksh")}
    : : else if (weekday[d.getDay()]=="Thursday")
    : : {document.write("yes")}
    : : else if (weekday[d.getDay()]=="Tuesday")
    : : {document.write("shfjksh")}
    : :
    : :
    : :
    : :
    : : Any help or advice will be highly appreciated.
    : :
    : : Eager Student
    : :
    : Check out this site: http://www.w3schools.com/js/js_conditionals.asp
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories