Would like to know what is the difference between variable test1 and test2 in the following code.
function myClass(){
var test1 = 'abc';
this.test2 = 'def';
this.Method1 = function(){
someObj(this.success);
}
this.success = function(){
console.log(test1); //able to output value
console.log(this.test2); //unable to get the output
console.log(test2); //unable to get the output
}
}
Edit: to make more precise, I was trying to access to the variable from an inner function. I couldn't access to the test2 variable, but able to extract the value from test1.