So I am quite new to cookies and I was wondering why this doesn't work to read cookie data?
//How to sort through the cookies
document.cookie = "key1=value1; key2=value2";
console.log(document.cookie);
//Makes an array of the Cookies
let pairs = document.cookie.split(";");
//Dictionary
let cookieDictionary={};
//Loops through the cookies and assigns them to a dictionary.
for(p of pairs)
{
let vals = p.split("=");
cookieDictionary[vals[0]] = vals[1];
}
//Create a key for easy cookie lookup
let cookieKeys = Object.keys(cookieDictionary);
console.log(cookieKeys);