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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.