87.6k views
3 votes
Var cookie = "username=mike2009";

cookie += "; max-age=" + 365 * 24 * 60 * 60;
cookie += "; path=/";
document.cookie = cookie;

(Refer to code example 15-1.) This code


creates a cookie with a name of “username” and a value of “mike2009”

creates a cookie with a name of “max-age” and a value of “31536000”.

creates a cookie with a name of “path” and a value of “/”.

does not create a cookie

User Mr Teeth
by
5.0k points

1 Answer

0 votes

Answer:

creates a cookie with a name of “username” and a value of “mike2009”

Step-by-step explanation:

This javascript code creates a cookie with the name "username" and it's value is "mike2009".This cookie expires after 1 year.Mentioned in the max-age function.Since max-age function takes arguments in seconds so the it sums up to 1 year.It will be deleted after one year.

User Grant Williams
by
5.4k points