How can I create and read a value from a cookie in JavaScript?
A cheeky and simple way of reading a cookie could be something like:
let username, id;
eval(document.cookie);
console.log(username + ", " + id); // John Doe, 123
This could be used if you know your cookie contains something like: username="John Doe"; id=123;
. Note that a string would need quotes in the cookie. Not the recommended way probably, but works for testing/learning.