Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
131
rated 0 times [  135] [ 4]  / answers: 1 / hits: 38442  / 12 Years ago, fri, december 7, 2012, 12:00:00

How can I access some variables inside



$(document).ready(function(){
var foo=0;
var bar = 3;
});


from Google chrome console? If I try alert(foo), I will get a message that it is not defined.


More From » jquery

 Answers
61

Put a breakpoint with the debugger. You'll get full access to them when the debugger will stop.



Other answers telling you to put them in the global scope are bad. Don't use bad practices just because you don't know how to use the right tools.


[#81545] Thursday, December 6, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tina

Total Points: 91
Total Questions: 106
Total Answers: 104

Location: Vanuatu
Member since Fri, May 13, 2022
2 Years ago
;