JavaScript Extra Credit

Nothing Fancy....

Variables Contain New Strings

See I warned you, nothing real fancy.... :-)

Strings and Variables

Here is the code for the new variables:

	document.write ("<p>Write out the new variables:</p>")
	document.write ("Here is the value for the variable str1: " + str1);
	document.write ("<br />Here is the value for the variable str2: " + str2);
	document.write ("<br />Here is the value for the variable str3: " + str3);
	document.write ("<br />Here is the value for the variable str4: " + str4);
	document.write ("<br />German Shepherds are great dogs and I especially love<b> " + str2 + str3 + str4 + "</b>");

+ Operator

What you should notice is the way you tie in a string with a variable in the document.write is by using the plus + sign.

Quotes

Note that you must use quotes around the string BUT not around the variables.

Oh and to get spaces between the words "Jazzy and Rummel" in the final document.write, I cheated. Yep, I added spaces before and after those words in the variable assignment. If I had not done that, those 3 words would have been squished together, or I would have had to add in spaces between quotes to the variables (which was more work than I wanted to do for this little assignment).

Maybe that made it worth reading this page?