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”;