JS for and if statement

This code takes the same sentence we saw in the Week 2 String Manipulation exercise but looks for words in that sentence that equal two variables animal_1 which is "fox" and animal_2 which is "dog".

This is done by going through the sentence and collecting the words. Then comparing them to the variable values.

The Code:

	var strSentence, strCharacter, strWord, intWord;
	var animal_1, animal_2;
		
	strSentence="The quick brown fox jumped over the lazy dog.";
	strWord="";
	intWord=0;
	animal_1="fox";
	animal_2="dog";
	
	for (count=0; count<=44; count++){
		strCharacter=strSentence.charAt(count);
		if ((strCharacter==" ") || (strCharacter==".")){
			if((strWord==animal_1) || (strWord==animal_2)){
			intWord++;
				document.write("<i class='g'>Animal number</i><b> " + intWord + "</b> <i class='b'> is a</i> <b>" + strWord + "</b><br />");
			}//close if
			strWord="";
		}//close if
			else {
					strWord+=strCharacter;
					}//close else
		}//close for