Skip to content

Commit b2ad445

Browse files
committed
a
1 parent 9532041 commit b2ad445

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### What are the options in a cookie
2+
3+
There are few below options available for a cookie,
4+
5+
By default, the cookie is deleted when the browser is closed but you can change this behavior by setting expiry date (in UTC time).
6+
7+
```js
8+
document.cookie = "username=John; expires=Sat, 8 Jun 2019 12:00:00 UTC"
9+
```
10+
11+
By default, the cookie belongs to a current page. But you can tell the browser what path the cookie belongs to using a path parameter.
12+
13+
```js
14+
document.cookie = "username=John; path=/services"
15+
```

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ A collection of super-popular Interview questions, along with explanations and i
168168
- [Memoize a function](Large-Collection-of-Popular-Problems-with-Solutions/Objects-Master-List-of-Problems-Super-Useful-Daily-Techniques/Memoize-a-function.md)
169169
- [repaint-reflow](Javascript/repaint-reflow.md)
170170
- [What are events?](Javascript/what-are-events.md)
171+
- [What are the options in a cookie](Javascript/What-are-the-options-in-a-cookie.md)
171172

172173
[[] Back to top](#table-of-contents-of-this-readme-file)
173174

0 commit comments

Comments
 (0)