CPSC415A
Web Programming

Assignment 12

JavaScript Classes

Create a JavaScript class called Cookie. The class should have:

  1. a private property, name, the name of the cookie
  2. a constructor with one parameter that sets the name property
  3. a method that gets the cookie’s value
  4. a method that sets sets the cookie’s value

The class should use JavaScript cookies so that when the web browser is closed and reopend the value of the cookie is preserved. Note, it should work even when there are multiple cookies stored for the web site. It can use any experation date that will allow the cookies to persist between opening and closing the browser.

Submission

Submit your code on the course Inquire site.