Client-Side Web Development - Graded Assignment #6

This assignment must be completed with Javascript constructs covered in the module.
The HTML and Javascript file should not be modified in any way except as specified below.

  1. Use VS Code to open files index.html and main.js, in which you completed the previous assignments.
  2. In the Javascript file, write a function that removes the last word, and the space character preceding it, from the long paragraph text. Non-alphanumeric characters do not need any special treatment (for example, "hello" can be treated as a word and removed entirely). Add an event handler in the HTML file so that the function is called when the paragraph with the text is clicked.

    TIP: To break up the paragraph string into words and put it back again after removing the last word, you can use the string method split and the array method join.
  3. In the HTML file, add or remove Bootstrap classes to make sure that the elements with number names (one, two, three, four, five) have borders and that the other elements do not. Add a horizontal line element (<hr>) and a button to the HTML file, as the last two elements in the Bootstrap container element.
  4. In the Javascript file, write a function with one parameter. The function should replace the text in all 5 elements that have a border, with the string contained in the parameter.
  5. In the HTML file, set the function just defined as handler for clicks on the button created for this assignement, passing string "???" to the function. Change the name of the button so that it reflects the button's purpose.

 

For a video demonstrating the required behaviour click here.

For information on submission deadline and grading of this assignment see the the Schedule and Notes page, below the table.