Function I/O
function chorus(){
var output = "";
output += "... and they all go marching" + "\n";
output += "down. " + "\n";
output += "to the ground." + "\n";
output += "to get out." + "\n";
output += "of the rain." + "\n";
output += "Boom boom boom boom...." + "\n";
return output;
}
function verse(verseNum){
var output = "";
switch (verseNum){
case 1:
distraction = "suck his thumb";
break;
case 2:
distraction = "tie his shoe";
break;
default:
distraction = "I have no idea";
break;
} // end switch
output += "The ants go marching " + verseNum + " by " + verseNum + ", hurrah, hurrah" + "\n";
output += "The ants go marching " + verseNum + " by " + verseNum + ", hurrah, hurrah" + "\n";
output += "The ants go marching " + verseNum + " by " + verseNum + "\n";
output += "the little one stops";
output += "to " + distraction;
return output;
} // end verse
alert(verse(1));
alert(chorus());
alert(verse(2));
alert(chorus());