Given this code:
var myObj = new Object({
data: {
val_a: 1,
val_b: 2
},
myfuncs: {
first_func: function() {
this.data.val_b = 3;
}
}
});
why does this fail:
myObj.myfuncs.first_func()
with error:
VM154:9 Uncaught TypeError: Cannot set property 'val_b' of undefined at Object.first_func (:9:20) at :1:15
but this works:
myObj.data.val_b
And what's the correct way to access data.val_b from first_func?