You can not create a cookie that never expires (in theory), but you can set a cookie with the longest value possible for the expiry date value.
document.cookie = "my_cookie=cookie_value; expires=Fri, 31 Dec 9999 21:10:10 GMT";
cookie_value with any cookie value that you desire. Note that
31 Dec 9999 is the highest value that we can set for the cookie to be never expired (practically).
Reference: MSDN - Browser Cookie