JavaScript: how to check breakpoint values ​​in chrome debugging tools

I have a simple js file that prints a date continuously.

I am using Google Chrome Debugging Tools (F12)

I have set a breakpoint on the line s = date.getSeconds();

It stopped at this breakpoint.

My question is: can I see / check the value of the breakpoint? (if it's eclipsed, I would use Ctrl + Shift + i )

I know about the console option, but can I see the value in the debugger tool?

please view the screenshot.

enter image description here

Thanks in advance.

function date_time(id)
{
        date = new Date;
        year = date.getFullYear();
        month = date.getMonth();
        months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December');
        d = date.getDate();
        day = date.getDay();
        days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
        h = date.getHours();
        if(h<10)
        {
                h = "0"+h;
        }
        m = date.getMinutes();
        if(m<10)
        {
                m = "0"+m;
        }
        s = date.getSeconds();
        if(s<10)
        {
                s = "0"+s;
        }
        result = ''+days[day]+' '+months[month]+' '+d+' '+year+' '+h+':'+m+':'+s;
        document.getElementById(id).innerHTML = result;
        setTimeout('date_time("'+id+'");','1000');
        return true;
}

      

+3


source to share


2 answers


You can

  • hover your mouse over the variables of interest
  • open the Scope Variables section on the right side panel.
  • open the console ("Press Esc") and enter the variable to see its value.


For example:

enter image description here

+4


source


select the breakpoint variable 's' and right click on the selected 's' and select the add to view option then u can see the value of s on the right side of the Chrome Debugger window and press F10 for the next line.



+2


source







All Articles