sorry to bother u but i can’t get my mistake in the following code, that makes me getting this "Cannot access ‘date’ before initialization", Any help is much appreciated. Thanks.
document.querySelector('a').addEventListener('click', function () {
let date = new date(date.now() + 86400000);
date = date.toUTCString();
document.cookie = 'acceptsCookies=true; path=/; expires=' + date;
});
>Solution :
It should be Date not date
let date = new Date(Date.now() + 86400000);
The interpreter thinks, that you use the date variable.