Assignments JS.DOM.1

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.DOM.0

Find your solution to the section called “Assignment JS.Conds.0”, make a branch and do the following:

  • In the copy replace the 10 times if-else constructions with switches. Use my first suggestion without default. Test until it works.
  • Try my second suggestion with default at the end. test that it works.
  • Try moving the default up, so that it occurs just before the case 3: clause. Now test thoroughly, and tell me your conslusion.

Assignment JS.DOM.1

Write a page with an HTML5 form to enter a name and a birthday. The name must be more than one character long, and the birthday must be a valid date.

The entered data must be caught by JavaScript and used to make a cookie with a name-value pair. The name must be the concatenation of name and birthday, and the value must be '42' as in 'nml251145=42'. Give the cookie a lifespan of 10 minutes. Ten minutes are 0.00694444 years! Test repeatedly until it works.

You may check the cookie content by means of the log.

Once the JavaScript works, close the browser, take 10, and then restart your browser to ascertain that the expiration mechanism works.