Assignments JS Loose Ends

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 JS.LocalStorage.0

Assignment JS.Regex.0

Write a regular expression that extracts the domain name portion of a Web URL (excluding the “ www. ” subdomain if supplied). The protocol portion of the URL should be optional. For example, the expression should extract the domain name “ example.com ” from any of the following URLs:

  • http://www.example.com/
  • http://www.example.com/hello/there.html
  • http://example.com/hello/there.html
  • www.example.com/hello/there.html
  • https://www.example.com

Assignment JS.Regex.1

Enhance the script displayed earlier at the section called “An Example Inspired by [Doy11]” to display not just the URL of each link, but also the link text (the text between the < a > and < /a > tags).

Assignment JS.Regex.2

Make an HTML5/JavaScript page documenting whether the special characters 'æ', 'ø', and 'å', and perhaps others, are part of the Regular Expression concept of word characters.

Assignment JS.Regex.3

Include the file http://dkexit.eu/downloads/17192_8.js in a web page. It is a JS file holding a string constant named text2. The constant is an annotated poem by Poe, re the C-comments of the file. Make a wordlist in an array by means of a match. How many words are in the text? Make the page print the number.

By traversing the word array make a new array that has all the different words from the first array, and a count for each of those words. Print the array on the page.

Finally the page must display a character count, What is the frequency of each letter in the alphabet. Create an object with the result as in

'use strict';
let obj = {
    a: 2.56,
    b: 0.24,
    ,,,
    z: 0.86
};

and place the results on the page.

When you are done. Do the same with http://dkexit.eu/downloads/8fdmf10.js as input. It is a JS file holding a string constant named text1. The constant is a Danish text from the late 19th century.