My sentence is "A document cannot be fully loaded until all the scripts have executed."
I decided I wanted to print out words that had a certain number of characters in them. I decided on words that were 6 or 8 characters long.
This required that I had to mess around with where I would test for length. And as it works I needed to do was a test for length in the second loop.
Remember that the double equal sign == is the comparison operator not the single equal sign =
var strSentence, strCharacter, strWord;
strSentence="A document cannot be fully loaded until all the scripts have executed.";
strWord="";
for (count=0; count<=70; count++){
strCharacter=strSentence.charAt(count);
if ((strCharacter==" ") || (strCharacter==".")){
if((strWord.length==6) || (strWord.length==8)){
document.write("<b>" + strWord + "</b>" + "<i class='g'> is a</i> " + "<b>" + strWord.length + "</b>" + "<i class='b'> letter word</i><br />");
}//end if
strWord="";
}//end if
else {
strWord+=strCharacter;
}//end else
}//end for