Detect Cookies in google extension

Does anybody know how to make a chrome extension that detects cookies and displays a message? I’m a total noob in extensions but have watched a YouTube tutorial on how to make one.

Try:

chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
  if (changeInfo.status === 'complete' && tab.active) {
    chrome.tabs.executeScript(tabId, {
      code: `document.cookie`
    }, ([result]) => {
      /* result is tab's cookie */
    });
  }
});