I'm trying to use cookies for a project I have, so I looked for a method to create them using JavaScript and found, looking on some websites, a function (it looks like a function) called document.cookie
. Using the following code on the console:
var value = "testCookie";
document.cookie = "testCookie=" + value + ";";
alert(document.cookie);
The alert, which should contain the cookie, appears blank, as if the cookie had not been created. What am I doing wrong? If you can tell me, I will be immensely grateful!