What JavaScript command can be used to get the cookie values from the DOM
Use document.cookie to read cookie values from the page. It returns all
accessible cookies as a single string of name=value pairs separated by
semicolons, which you can then parse for a specific cookie.
Example
javascript
console.log(document.cookie);
Get one cookie by name
javascript
function getCookie(name) {
const cookies = document.cookie.split('; ');
const found = cookies.find(row => row.startsWith(name + '='));
return found ? found.split('=').slice(1).join('=') : null;
}
Important note
Cookies marked HttpOnly cannot be read from JavaScript, so they will not
appear through document.cookie.
TL;DR: the JavaScript command is document.cookie.