How do I access a variable from Chrome's console?

Couldn’t access my code from Chrome’s console, and couldn’t find info about how to do it.

I guess the console is working with more than one file, so we must access the desired file somehow.
Please advice,

If x is just floating around in the global scope it should be accessible, but if it is wrapped in some function it will throw an undefined error. for example, I just tried this myself:

var x = 1;
var y = function() {
    var z = 5;
    return 10;

I can get x and the function y. Even if I execute y() I still cannot access z.

Did u look at the image I posted? How do u explain the difference between the screenshot and your answer?

console.log() doesn’t seem to work in debug mode in the Chrome console. Remove debug mode maybe? When I did it worked.


Sure. So alone by itself it’s not going to run. You need to put that code into a function and when that function is invoked it will run. Does that make since? For example say you have some text on a page and when you click on some text you want it to change the padding around that box to red.

With jquery you’re going to listen for a click event. Well, in that callback function you’re going to add the debugger. Does that make since? Run this code here on freecodecamps forum.

$('#site-logo').on('click', function(){

and click the logo.

Updating Chrome from version 56 to the latest (57) solved the problem. The topic will be deleted later today. Thank you for all of you for taking time to respond to my question.