I understand that there are quite a few question similar to this one but I couldn't find any which answers why or may how the context(value) of this changes when a callback function is called from inside the object function like this
var obj = {
objproperty: "this is a property of obj",
func1: function(x,cb){
console.log(this) // refers to obj
var output_value = x + 20;
cb(output_value);
}
};
obj.func1(123,function(output_value){
console.log(output_value);
console.log(this); // does this refers to window or undefined??
});
as far as I understand the value shouldn't 'this' in third console.log be referring obj? as it called on the obj Object ?