I was doing some tests here, and I noticed a difference in this
within literal objects:
obj = {
context: this,
showContext: function(){ return this }
}
If I do pessoa.context
the this
will point to the object window
, but if I do pessoa.showContext()
the this
returned will point to the object obj
and not to the showContext
. Does anyone know the reason for this behavior?