
Why we are used setMaxAge() and getMaxAge() in Cookies ?

setMaxAge : Sets the maximum age of the cookie. The cookie will expire after that many seconds have passed. Negative values indicate the default behavior, and will be deleted when the browser closes.
getMaxAge : Returns the maximum specified age of the cookie. If none was specified, a negative value is returned, indicating the default behavior described with setMaxAge.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.