title: Chrome - Access variables from a webpage through my console
body: <p>If I have a page, that defines a set of JavaScript variables, for example:</p>
  
  <pre><code>const pageId = 1
  const pageName = "pName"
  </code></pre>
  
  <p>Is it possible for me to access the variable by typing in the console window.</p>
  
  <p>I know I can add code to the page to make the page output the variables eg:</p>
  
  <pre><code>console.log(pageId)
  </code></pre>
  
  <p>Will output 1 to to the console window, but this is not what I am asking.</p>
  
  <p>I want to run the page with the code as it is, and then type into the <code>Chrome</code> developer tools, console tab, to get it to display the value of whatever variable I choose.</p>
  
  <p><a href="https://i.stack.imgur.com/lhqwY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lhqwY.png" alt="enter image description here"></a></p>
  
  <p>Is this possible?</p>