0 votes
in JavaScript by
How can you create a cookie with the help of JavaScript?

1 Answer

0 votes
by

You can create a cookie in JavaScript simply by assigning a string value to the document.cookie object. 

The syntax:

document.cookie = “key1 = value1; key2 = value2; expires = date”;

...