I have read the documentation for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
Why can't we directly access this.prop, but rather we have to write a function just to return this.prop?
var test = {
prop: 42,
func: function() {
return this.prop;
},
directAccess: this.prop
};
console.log(test.func());
// expected output: 42
console.log(test.directAccess);
// expected output: 42
// actual output: undefined