Tuesday, August 19, 2014

Previous Interview Question Next Interview Question
Home

which of the following lines from the code snippet below will generate an error?

<script type = "text/javascript">
var d=new Date();
whatDay=d.getDay();
switch(whatDay)
{
case 5:
document.write("TGIF");
break;
case 6:
document.write("Relaxing saturday");
break;
Case 0:
document.write("Get ready for Sunday")
break;
default:
document.write("I could use a rest day");
}
</script>

          a)      Var d = new Date();
          b)      whatDay = d.getDay();
          c)       switch(Whatday);
          d)      there is no erroneous line of code


Answer :  D

Previous Interview Question Next Interview Question
Home

1 comments :

  1. I would think whatDay because it should be declared

    ReplyDelete