Programming Puzzle. Build a tool that allows the user to see how many words, sentences, spaces, and average words per sentence are contained within a passage of text

(Audrey Simmons) #1


Include an area for users to enter text
Include a button that a user can click to trigger the analysis of the input text
Include 4 paragraph elements that will be used to display the calculated stats


This is what the rendered HTML should look like before a user presses the button.

When the button is clicked, do the following:

Assign the value of the text area input to a variable
Loop over the input and keep track of the
    total number of words (Hint: How do you know when there is a new word?)
    total number of sentences (Hint: How do you know when a sentence ends?)
    average words per sentence
    total number of spaces
Change the text of the 4 paragraph elements to display these four calculated stats. (Hint: innerHTML)


This is an example of what should show up after the user clicks the button.

Make use of loops, functions, if statements and variables.

Don’t use the JavaScript .split() function