Assignments DE.4

Handing In Assignments

You must hand in by using git

Hand In by git

  • Create an empty repo on bitbucket.org, gitlab.com, or github.com,
  • git push your local repo to the above remote repo.
  • For node assignments please put the line(s)

    node_modules/

    into your .gitignore file.

Send a mail to with:

  • The word 'handin <subjectname>' in the subject line of your mail
  • The url of your repo(s).

Assignment DE.5.0

I will outline a JavaScript task and you must solve it using the inspector, log, debugger, possibly the css editor, etc. of todays lesson. The process of solving this assignment must be documented in a series of slides that you will present in the next lesson. Do the following step by step:

  1. Create a new basic HTML5 page to be used for the following.
  2. Create an array placesToVisit using any method as outlined in the recent JavaScript lesson about arrays. Populate the array with five US cities you'd like to visit.
  3. Using a for-loop, loop through the array and display the content of the array, element by element, with document.write().
  4. Add the city Jackson to the end of the array.
  5. Create a function outputArray(theArray) that displays the array content given the variable name of the array as input argument.
  6. Call the function outputArray() with placesToVisit as an argument.
  7. Put the function call into your HTML5 document.
  8. Remove the first two items from the array by using the splice() function.
  9. Call the outputArray() function to display the array after the removal.
  10. Sort the array alphabetically.
  11. Display the array again.
  12. Test and save. Don't forget to use git.