134. create your own Cookie
Share
medium - accepted / - tried
We can get and set cookie by document.cookie
.
document.cookie = 'bfe=dev'// "bfe=dev"document.cookie = 'bfe1=dev1'// "bfe1=dev1"document.cookie// "bfe=dev; bfe1=dev1"
Please create your own myCookie
.
- it should support get and set.
document.myCookie = 'bfe=dev'// "bfe=dev"document.myCookie = 'bfe1=dev1'// "bfe1=dev1"document.myCookie// "bfe=dev; bfe1=dev1"
- there a few options to cookie, but in this problem, you only need to support
max-age
which means the cookie should be deleted after certain time(in seconds).
document.myCookie = 'bfe=dev; max-age=1'// "bfe=dev; max-age=1"document.myCookie// "bfe=dev"
after 1 second
document.myCookie// ""
- in your code, please enable
myCookie
ininstall()
and remove the logic inuninstall()
, these are used in judging.
Related Lists
implement it by yourself