Cookies In Javascript

Last weekend, I had a job interview with regards to Javascript. I was asked if Javascript can pass values from one page to another. All I said was if it is possible, I can look it up in Google. When my initial exam started, I looked it up if it is indeed possible. And voila, cookies were mentioned. I have never used cookies in Javascript before so I totally had no idea until I looked it up. The best functions for me in setting and retrieving cookies in Javascript are the functions found in a W3Schools column.

Using these two functions below, you can set and get a cookie (depending on the expiry value you specify).

Related Posts Plugin for WordPress, Blogger...

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *