In the js code specified below –
var tclass = function(){
this.func2=function(){console.log('func2')};
this.b={
func1: function(){console.log('func1')}
}
}
how do i call func2 inside func1 on the same instance?
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.
You’d have to keep a reference to both
thisand that function in the closure.Also it’s more useful to declare functions with actual function declaration statements: