I'm getting this error "Cannot access 'date' before initialization"
document.querySelector('a').addEventListener('click', function () {
let date = new date(date.now() + 86400000);
date = date.toUTCString();
document.cookie = 'acceptsCookies=true; path=/; expires=' + date;
});
It should be Date not date
let date = new Date(Date.now() + 86400000);
The interpreter thinks, that you use the date variable.