String Manipulation

1. Why do we use == in the IF statement?

It tell JavaScript to compare the right side to the left side.

2. What happens when you change the == to =?

JavaScript is now assigning the right side to the left side, which means in this particular case strCharacter now equals a blank space so that is what is printed out every loop.

3. Experiment with the value COUNT.

Making the COUNT higher does nothing because there are no more letters in the string. Making the COUNT smaller causes less words to print out depending on how much smaller the number you make. If a space or a period is not reached then the word will not print out.

4. Change the logical OR (||) to a logical AND (&&) operator.

Changing the operator to and will make cause nothing to print out because there will never be a space and period to trigger the document.write method to go.

5. The document.write() method is concatenating some strings with variables. Customize the String Literals to text/or HTML tags. Is there a way to enter the text/tags other than using string literals?

I added color and font formatting using an external style sheet and class selector. I do not think there is any other way to do this but to enter it as a string literal. Using the style sheet makes for a less confusing job then trying to format each word for all the different possibilities such as font-family, color, size, style etc.

6. Create a sentence of your own.

7. List 3 uses for parsing strings. Is this important?

Parsing would be useful in evaluating what is really happening in your code. If you have a question on what it is doing you could do as we did in this exercise, and write out what each step is doing.