I'm using the following code to retrieve a value from a cookie on example.com. The code works correctly and retrieves the value from the cookie and is logging it in the console as intended. How do I turn cookie.value into a variable to use it elsewhere outside the chrome.cookies.get statement?
chrome.cookies.get({url: "https://www.example.com/", name: "preferences"}, cookie => {
console.log('got a cookie!', cookie);
console.log(cookie.value);
});
Thanks in advance for your help.